Appendix C. strftime() Time Formats

strftime() is a standard C library function that formats date and time values according to a format defined in a specification string; it is composed of literal text interspersed with the conversion specifiers defined in Table C-1. These format specifiers are used in log format strings and SSI configuration options, as well as to define log file templates for the rotatelogs and cronolog log file rotation programs.

Table C-1. strftime( ) format specifiers

Spec

Description

%a

Abbreviated name of the day of the week

%A

Full name of the day of the week

%b

Abbreviated month name according to the current locale

%B

Full month name according to the current locale

%c

Preferred date and time representation for the current locale

%d

Two-digit day of the month (01–31)

%H

Two-digit hour using the 24-hour clock (01–23)

%I

Two-digit hour using the 12-hour clock (01–12)

%j

Three-digit day of the year (001–366)

%M

Two-digit minutes part of the time (00–59)

%m

Two-digit month number (01–12)

%p

Current locale’s AM/PM indicator

%S

Seconds part of the time (00–61, to allow for leap seconds)

%U

Two-digit week number (00–53, where weeks start on a Sunday and week 1 is the first full week of the year)

%W

Two-digit week number (00–53, where weeks start on a Monday and week 1 is the first full week of the year)

%w

Day of the week (0–6, where 0 represents Sunday)

%X

Preferred time representation for the current locale (without the date)

%x

Preferred date representation for the current ...

Get Apache 2 Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.