The syntax of the function is as follows:
size_t strftime(char* s, size_t maxsize, const char* format, const struct tm * Tmptr);
The function strftime () formats the broken-down time tm into an array pointed to by s according to the specified formatting string pointed to by format. The size of array is limited by maxsize. The formatting string consists of 0 or more conversion Specifiers and ordinary characters. The ordinary characters placed in the formatting string are copied into s without any conversion. Each specifier consists of a percent character(%) followed by a character that determines the action of conversion specifier. Some conversion Specifiers may have an additional modifier character E or 0 placed between% symbol and the conversion specifier character. The strftime() function returns the number of characters placed in the arrays, not including the terminating Null character.
Illustrates application of function strftime ().
#include <stdio.h> #include <time.h> void main() { time_t Justnow; struct tm *Date; char string[15]; time(& Justnow); Date= localtime(& Justnow); clrscr(); strftime(string, sizeof (string), "%d-%b-%y\n", Date); printf("%s", string); }