mysql datetime형식을 mfc에서 cstring으로 변환
검색어 : afxmessagebox format ,date
https://www.gidforums.com/t-17865.html
Hi,
I don't know for sure if I am asking the correct question. Following setup: dialog based MFC application, which connects with a second application via a COM interface.
Say I have defined via the COM interface an Object called item.
I can access several properties of item (price, date, name etc....). For example using item->price (returns float) .
If I get an integer, float, or string I know how to convert to CString to do an output via AfxMessageBox().
But what is returned if I do item->date and how can i display it using a CString (for AfxMessageBox)? Unfortunately the documentation of the com server doesn't say anything. Is there some canonical answer?
There is some type DATE I found via google and I tried the following
DATE d;
d=item->date;
(compiles)
but AfxMessageBox(d); doesn't compile.
I have found some examples for this com server, unfortunately in C#, there the command ToString() is used to convert every property of item.
What can I do?
Sam - See more at: https://www.gidforums.com/t-17865.html#sthash.9FJInPIz.dpuf
Hi,
thank you for answer.
COleDateTime codt(item->date);
seems to works. Since I can't use cout I format it to a Cstring:
CString str = codt.Format();
Then I display it with AfxMessageBox(str);
Nice:-)
Thx again - See more at: https://www.gidforums.com/t-17865.html#sthash.9FJInPIz.dpuf
mysql 의 date형식의 데이터를 가져와서
mfc에 list control에 보여주기
COleDateTime codt(m_pSet->m_date);
CString str = codt.Format();
AfxMessageBox(str);
m_List.SetItemText(0, 1, str);
[ db 테이블에 보이는 데이터]
[ mfc실행시 보이는 화면 ]