Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

System time

Does anyone know how to display the system time\date\mins\etc  in a CString?

I know you have to use GetSystemTime,  but does anyone have an example I could use.  thanx
0
needhlp
Asked:
needhlp
1 Solution
 
migelCommented:
Try to use this code
   CTime timeWrite;   timeWrite = CTime::GetCurrentTime();
   // write the time out
   CString str = timeWrite.Format("%d %b %y %H:%M:%S");
//  look help for the CTime::Format to understand format symbols
0
 
needhlpAuthor Commented:
Whoa, thanx!  : )

how do you get the months to display as numbers?

thanx again
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now