Time Formatting Directives
These directives in Table 20 are used with the method Time#strftime.
Table 20. Directives for formatting time
Directive | Description |
|---|---|
| The abbreviated weekday name (Sun). |
| The full weekday name (Sunday). |
| The abbreviated month name (Jan). |
| The full month name (January). |
| The preferred local date and time representation. |
| Day of the month (01 to 31). |
| Hour of the day, 24-hour clock (00 to 23). |
| Hour of the day, 12-hour clock (01 to 12). |
| Day of the year (001 to 366). |
| Month of the year (01 to 12). |
| Minute of the hour (00 to 59). |
| Meridian indicator (AM or PM). |
| Second of the minute (00 to 60). |
| Week number of the current year, starting with the first Sunday as the first day of the first week (00 to 53). |
| Week number of the current year, starting with the first Monday as the first day of the first week (00 to 53). |
| Day of the week (Sunday is 0, 0 to 6). |
| Preferred representation for the date alone, no time. |
| Preferred representation for the time alone, no date. |
| Year without a century (00 to 99). |
| Year with century. |
| Time zone name. |
| Literal % character. |
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