Name
strftime
Synopsis
string strftime(stringformat[, inttimestamp])
Formats a time and date according to the
format string provided in the first
parameter and the current locale. If the second parameter is not
specified, the current time and date is used. The following
characters are recognized in the format
string:
|
|
Name of the day of the week as a three-letter abbreviation; e.g., “Mon” |
|
|
Name of the day of the week; e.g., “Monday” |
|
|
Name of the month as a three-letter abbreviation; e.g., “Aug” |
|
|
Name of the month; e.g., “August” |
|
|
Date and time in the preferred format for the current locale |
|
|
The last two digits of the century |
|
|
Day of the month as two digits, including a leading zero if necessary; e.g., “01” through “31” |
|
|
Same as |
|
|
Day of the month as two digits, including a leading space if necessary; e.g., “1” through “31” |
|
|
Same as |
|
|
Hour in 24-hour format, including a leading zero if necessary; e.g., “00” through “23” |
|
|
Hour in 12-hour format; e.g., “1” through “12” |
|
|
Day of the year, including leading zeros as necessary; e.g., “001” through “366” |
|
|
Month, including a leading zero if necessary; e.g., “01” through “12” |
|
|
Minutes |
|
|
The newline character ( |
|
|
“am” or “pm” |
|
|
Same as |
|
|
Same as |
|
|
Seconds |
|
|
The tab character ( |
|
|
Same as |
|
|
Numeric day of the week, starting with “1” for Monday |
|
|
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access