In C or C++ you can't just take an arbitrary structure and pass it to a function that expects a string. You have to convert that structure to a string first.
The Win32 functions GetDateFormat()
and GetTimeFormat()
can be used to convert a SYSTEMTIME
to a string (the first one does the "date" part and the second one does the "time" part) according to the current system locale rules.
For example,
SYSTEMTIME LocalTime = { 0 };
GetSystemTime (&LocalTime);
wchar_t wchBuf[80];
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &LocalTime, NULL, wchBuf, sizeof(wchBuf) / sizeof(wchBuf[0]));
SetDlgItemText(hWnd, 1003, wchBuf);