strftime
Example: Converting Time to Local Time | Date and Time Functions |
Converts time to a string, and writes the string into a memory area.
size_t *strftime( char *string, size_t maxlen, const char *format, const struct tm *timestruct);
string | Pointer to an null-terminated area of memory to hold the string data produced by this function. |
maxlen | Maximum number of characters that string can contain, including the null character '\0' at the end of the string. |
format | Format string indicating the information the function writes into string. Refer to your platform-specific documentation for details. |
timestruct | Pointer to a time structure as created by the gmtime or localtime functions. Refer to your platform-specific documentation for details. |
Under Linux, strftime is not thread-safe. Use strftime_r, instead. Refer to your platform-specific documentation for details.
Return Values
The number of characters written into string (not including the null '\0' character). If the function fails, the return value is zero, and the contents of string is undefined.