Synopsis
#include <time.h>
size_t strftime(char *s, size_t smax, const char *fmt, const struct tm *tp);
Description
strftime formats the *tp struct to a null terminated string of maximum size smax-1 into the array at *s based on the fmt format string. The format string consists of conversion specifications and ordinary characters. Conversion specifications start with a % character followed by an optional # character. The following conversion specifications are supported:
| %a | Abbreviated weekday name |
| %A | Full weekday name |
| %b | Abbreviated month name |
| %B | Full month name |
| %c | Date and time representation appropriate for locale |
| %#c | Long date and time representation appropriate for locale |
| %d | Day of month [01,31] |
| %#d | Day of month without leading zero [1,31] |
| %H | Hour in 24-hour format [00,23] |
| %#H | Hour in 24-hour format without leading zeros [0,23] |
| %I | Hour in 12-hour format [01,12] |
| %#I | Hour in 12-hour format without leading zeros [1,12] |
| %j | Day of year as a decimal number [001,366] |
| %#j | Day of year as a decimal number without leading zeros [1,366] |
| %m | Month as a decimal number [01,12] |
| %#m | Month as a decimal number without leading zeros [1,12] |
| %M | Minute as a decimal number [00,59] |
| %#M | Minute as a decimal number without leading zeros [0,59] |
| %#p | Locale's a.m or p.m indicator |
| %S | Second as a decimal number [00,59] |
| %#S | Second as a decimal number without leading zeros [0,59] |
| %U | Week number as a decimal number [00,53], Sunday is first day of the week |
| %#U | Week number as a decimal number without leading zeros [0,53], Sunday is first day of the week |
| %w | Weekday as a decimal number [0,6], Sunday is 0 |
| %W | Week number as a decimal number [00,53], Monday is first day of the week |
| %#W | Week number as a decimal number without leading zeros [0,53], Monday is first day of the week |
| %x | Locale's date representation |
| %#x | Locale's long date representation |
| %X | Locale's time representation |
| %y | Year without century, as a decimal number [00,99] |
| %#y | Year without century, as a decimal number without leading zeros [0,99] |
| %z,%Z | Timezone name or abbreviation |
| %% | % |