strftime formats a broken-down time stored in struct tm into a caller-provided character array. Like printf, it combines ordinary text with special percent codes, allowing the desired textual representation to be composed explicitly. section 8.6
A formatted date
A call such as strftime(buf, sizeof buf, "%F", &tm) requests a date using %F, equivalent to %Y-%m-%d. Other codes select fields such as seconds, month names, weekday names, time-zone information, or locale-dependent date and time forms. section 8.6
time_t time(time_t *t);
double difftime(time_t time1, time_t time0);
time_t mktime(struct tm tm[1]);
size_t strftime(char s[static 1], size_t max,
char const format[static 1],
struct tm const tm[static 1]);
int timespec_get(struct timespec ts[static 1], int base);
int timespec_getres(struct timespec ts[static 1], int base);
Use the declaration to identify the output array, its maximum size, the format string, and the struct tm value being represented. section 8.6
Important formatting choices include:
- %F produces an ISO 8601-style year-month-day date, while %x, %X, %B, %b, %A, and %a may depend on locale settings. section 8.6
- Prefer strftime for textual time presentation instead of deprecated asctime, whose static result buffer can be overwritten by later or parallel calls. section 8.6

