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

Comments

Popular posts from this blog

String.Replace vs Regex.Replace

C# Producer Consumer using Rabbit MQ

C# Form Application in Kiosk Mode/Fullscreen