C examples for wchar.h:wcsftime
function
<cwchar> <wchar.h>
Format time as wide string
size_t wcsftime (wchar_t* ptr, size_t maxsize, const wchar_t* format, const struct tm* timeptr);
Parameter | Description |
---|---|
ptr | the destination array |
maxsize | Maximum number of wide characters to copy. |
format | a format string as format in strftime. |
timeptr | a tm structure. |
On success, the total number of characters copied to ptr is returned.
Otherwise, zero is returned.
#include <wchar.h> #include <time.h> int main ()// w w w. j a v a 2s . co m { time_t rawtime; struct tm * timeinfo; wchar_t buffer [80]; time ( &rawtime ); timeinfo = localtime ( &rawtime ); wcsftime (buffer,80,L"Now it's %I:%M%p.",timeinfo); wprintf (L"%ls\n",buffer); return 0; }