Posts

Showing posts with the label Date

MFC getting the current date and time

I've been updating some older MFC/C++ applications and I found I needed to get the current system time. There's a way in the Win32 API but it's clunky. MFC gives you a simple way. CTime t = CTime :: GetCurrentTime (); CString s = t . Format ( "%m%d%Y" ); The Format method can take a wide variety of parameters. See this MSDN link