The ANSI C standard defines a set of directives used to parse and format date and time strings.
Simple Log Service supports all the directives defined in the ANSI C (1989 version) standard. The following table describes these directives and provides specific examples and notes.
Directive | Description | Example | Note |
%a | The abbreviation of the weekday. |
| Currently, date and time strings are displayed in the en-US locale. Other locales are not supported. |
%A | The full name of the weekday. |
| Currently, date and time strings are displayed in the en-US locale. Other locales are not supported. |
%w | The weekday represented as a decimal number. 0 indicates Sunday, and 6 indicates Saturday. |
| None. |
%d | The day of the month represented as a zero-padded decimal number. |
| The leading zero is optional for formatting directives |
%b | The abbreviation of the month. |
| Currently, date and time strings are displayed in the en-US locale. Other locales are not supported. |
%B | The full name of the month. |
| The leading zero is optional for formatting directives |
%m | The month represented as a zero-padded decimal number. |
| The leading zero is optional for formatting directives |
%y | The year without the century part, represented as a zero-padded decimal number. |
| The leading zero is optional for formatting directives |
%Y | The year with the century part, represented as a zero-padded decimal number. |
| A year can be parsed from a number that ranges from 1 to 9999. If the year is earlier than 1000, it must be zero-filled to 4-digit width. For example, 0180 indicates the year of 180 AD. |
%H | The hour in the 24-hour format, represented as a zero-padded decimal number. |
| The leading zero is optional for formatting directives |
%I | The hour in the 12-hour format, represented as a zero-padded decimal number. |
| The leading zero is optional for formatting directives |
%p | The period in the 12-hour format. |
|
|
%M | The minute represented as a zero-padded decimal number. |
| The leading zero is optional for formatting directives |
%S | The second represented as a zero-padded decimal number. |
|
|
%f | The microsecond represented as a zero-padded decimal number. |
| The |
%z | The UTC offset in the ±HHMM[SS[.ffffff]] format. An empty string is generated for this directive during parsing if the date and time string does not contain the time zone information. |
| The |
%Z | The name of the time zone. An empty string is generated for this directive during parsing if the date and time string does not contain the time zone information. |
| None. |
%j | The day of the year. |
| The leading zero is optional for formatting directives |
%U | The week number of the year, where Sunday is the first day of a week. A day before the first Sunday of the year is regarded as a day in week 0. |
|
|
%W | The week number of the year, where Monday is the first day of a week. A day before the first Monday of the year is regarded as a day in week 0. |
|
|
%c | The date and time representation in the current locale. |
| Currently, date and time strings are displayed in the en-US locale. Other locales are not supported. |
%x | The date representation in the current locale. |
| Currently, date and time strings are displayed in the en-US locale. Other locales are not supported. |
%X | The time representation in the current locale. |
| Currently, date and time strings are displayed in the en-US locale. Other locales are not supported. |
%% | The literal |
| None. |
Several additional directives not defined in the C (1989 version) standard are included for convenience.
Directive | Description | Example | Note |
%G | The ISO 8601 week-based year. |
| When used to parse data and time strings, the values obtained through the |
%u | The ISO 8601 weekday, where Monday is the first day of a week. |
| None. |
%V | The ISO 8601 week number, where Monday is the first day of a week. |
|
|