We help IT Professionals succeed at work.

How do I convert CTime to CString?

shaolinfunk
shaolinfunk asked
on
I call a function that retrieves the time a particular event occurred and returns it in CTime format.  See code.

My question is, how do I convert that CTime value into a CString (so that I can later output it to text)?
CTime ct(Doodad->GetEventTime());

ct.Format("%H:%M:%S")

Open in new window

Comment
Watch Question

Top Expert 2010
Commented:
CTime theTime;
CString s;

theTime = CTime::GetCurrentTime();
s += theTime.Format( "%A, %B %d, %Y at %Hh%M." );

Hope this gives you any idea...
Top Expert 2012
Commented:
Um, you almost had it there yourself, al that's left is using the return value of 'Format()':
CTime ct(Doodad->GetEventTime());

CString str = ct.Format("%H:%M:%S");

Open in new window

trinitrotolueneDirector - Software Engineering

Commented: