size_t wcsftime(wchar_t* wpOutput,
size_t uiMaxSize,
const wchar_t* kwpFormat,
const tm* kqpTimePtr);#include <cwchar>
#include <ctime>
int main()
{
time_t qTime;
tm* qpTimeSpec;
// Get the number of seconds since midnight Jan. 1, 1970
time(&qTime);
// Convert the seconds to a tm struct variable
qpTimeSpec = gmtime(&qTime);
wchar_t waTime[100];
size_t uiActualLength = wcsftime(waTime, 100, L"%I:%M %p", qpTimeSpec);
wprintf(L"Written length = %u\n", uiActualLength);
wprintf(L"Time = %ws\n", waTime);
// Keep the window open until "Enter" is pressed
getwchar();
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.