size_t wcsftime (wchar_t* ptr, size_t maxsize, const wchar_t* format, const struct tm* timeptr);
Format time as wide string
Copies into ptr the content of format, expanding its format tags into the corresponding values as specified by timeptr, with a limit of maxsize characters.
This is the wide character equivalent of strftime (<ctime>).
- Pointer to the destination array where the resulting C wide string is copied.
- Maximum number of wide characters to be copied to ptr.
- C wide string that contains a format string that follows the same specifications as format in strftime (see strftime for details).
- Pointer to a tm structure that contains a calendar time broken down into its components (see struct tm).
If the resulting C wide string fits in less than maxsize wide characters including the terminating null wide character, the total number of characters copied to ptr (not including the terminating null wide character) is returned.
Otherwise, zero is returned and the contents of the array are indeterminate.
/* wcsftime example */
int main ()
struct tm * timeinfo;
wchar_t buffer ;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
wcsftime (buffer,80,L"Now it's %I:%M%p.",timeinfo);
- Format time as string (function)
- Convert time_t value to string (function)
- Convert tm structure to string (function)