This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.

3230. Format specifier %y/%Y is missing locale alternative versions

Section: 29.13 [time.parse] Status: C++20 Submitter: Tomasz Kamiński Opened: 2019-06-29 Last modified: 2021-02-25

Priority: 0

View all other issues in [time.parse].

View all issues with C++20 status.

Discussion:

The year format specifier ('y', 'Y') are missing the locale alternative version ('%EY', '%Ey' and '%Oy'). That makes it inconsistent with the POSIX strftime specification:

  1. %Ey Replaced by the offset from %EC (year only) in the locale's alternative representation.

  2. %EY Replaced by the full alternative year representation.

  3. %Oy Replaced by the year (offset from %C) using the locale's alternative numeric symbols.

and parse specifiers 29.13 [time.parse] that accepts these modified command.

[2019-07 Issue Prioritization]

Status to Tentatively Ready after five positive votes on the reflector.

Proposed resolution:

This wording is relative to N4820.

[Drafting note: For the '%Oy' specifier we preserve consistency with the current specification for '%Od' and '%Oe' from Table 87 "Meaning of format conversion specifier" [tab:time.format.spec]:

  1. %d […] The modified command %Od produces the locale's alternative representation.

  2. %e […] The modified command %Oe produces the locale's alternative representation.

as their corresponding POSIX specification is matching one for '%Oy':

  1. %Od Replaced by the day of the month, using the locale's alternative numeric symbols, filled as needed with leading zeros if there is any alternative symbol for zero; otherwise, with leading <space> characters.

  2. %Oe Replaced by the day of the month, using the locale's alternative numeric symbols, filled as needed with leading <space> characters.

]

  1. Modify "Table 87 — Meaning of format conversion specifiers" [tab:time.format.spec] as indicated:

    Table 87 — Meaning of format conversion specifiers [tab:time.format.spec]
    Specifier Replacement
    […]
    %y The last two decimal digits of the year. If the result is a single digit it is prefixed by 0. The modified command %Oy produces the locale's alternative representation. The modified command %Ey produces the locale's alternative representation of offset from %EC (year only).
    %Y The year as a decimal number. If the result is less than four digits it is left-padded with 0 to four digits. The modified command %EY produces the locale's alternative full year representation.
    […]