<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3230: Format specifier %y/%Y is missing locale alternative versions</title>
<meta property="og:title" content="Issue 3230: Format specifier %y/%Y is missing locale alternative versions">
<meta property="og:description" content="C++ library issue. Status: C++20">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3230.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#C++20">C++20</a> status.</em></p>
<h3 id="3230"><a href="lwg-defects.html#3230">3230</a>. Format specifier <code>%y/%Y</code> is missing locale alternative versions</h3>
<p><b>Section:</b> 30.13 <a href="https://wg21.link/time.parse">[time.parse]</a> <b>Status:</b> <a href="lwg-active.html#C++20">C++20</a>
 <b>Submitter:</b> Tomasz Kami&nacute;ski <b>Opened:</b> 2019-06-29 <b>Last modified:</b> 2021-02-25</p>
<p><b>Priority: </b>0
</p>
<p><b>View other</b> <a href="lwg-index-open.html#time.parse">active issues</a> in [time.parse].</p>
<p><b>View all other</b> <a href="lwg-index.html#time.parse">issues</a> in [time.parse].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#C++20">C++20</a> status.</p>
<p><b>Discussion:</b></p>
<p>
The year format specifier <code>('y', 'Y')</code> are missing the locale alternative
version <code>('%EY', '%Ey' and '%Oy')</code>. That makes it inconsistent with the
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html">POSIX
<code>strftime</code> specification</a>:
</p>
<ol style="list-style-type:none">
<li><p><code>%Ey</code>&emsp;Replaced by the offset from <code>%EC</code> (year only) in the locale's
alternative representation.</p></li>
<li><p><code>%EY</code>&emsp;Replaced by the full alternative year representation.</p></li>
<li><p><code>%Oy</code>&emsp;Replaced by the year (offset from <code>%C</code>) using the locale's
alternative numeric symbols.</p></li>
</ol>
<p>
and <code>parse</code> specifiers 30.13 <a href="https://wg21.link/time.parse">[time.parse]</a> that accepts these modified command.
</p>

<p><i>[2019-07 Issue Prioritization]</i></p>

<p>Status to Tentatively Ready after five positive votes on the reflector.</p>


<p id="res-3230"><b>Proposed resolution:</b></p>
<p>This wording is relative to <a href="https://wg21.link/n4820">N4820</a>.</p>

<blockquote class="note">
<p>
[<i>Drafting note:</i> For the <code>'%Oy'</code> specifier we preserve consistency with the current
specification for <code>'%Od'</code> and <code>'%Oe'</code> from Table 87 "Meaning of <code>format</code>
conversion specifier"  [tab:time.format.spec]:
</p>
<ol style="list-style-type:none">
<li><p><code>%d</code>&emsp;[&hellip;] The modified command <code>%Od</code> produces the locale's
alternative representation.</p></li>
<li><p><code>%e</code>&emsp;[&hellip;] The modified command <code>%Oe</code> produces the locale's
alternative representation.</p></li>
</ol>
<p>
as their corresponding POSIX specification is matching one for <code>'%Oy'</code>:
</p>
<ol style="list-style-type:none">
<li><p><code>%Od</code>&emsp;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 <code>&lt;space&gt;</code> characters.</p></li>
<li><p><code>%Oe</code>&emsp;Replaced by the day of the month, using the locale's alternative
numeric symbols, filled as needed with leading <code>&lt;space&gt;</code> characters.</p></li>
</ol>
<p>
]
</p>
</blockquote>

<ol>
<li><p>Modify "Table 87 &mdash; Meaning of <code>format</code> conversion specifiers"
 [tab:time.format.spec] as indicated:</p>

<blockquote>

<table border="1">
<caption>Table 87 &mdash; Meaning of <code>format</code> conversion specifiers  [tab:time.format.spec]</caption>
<tr style="text-align:center">
<th>Specifier</th>
<th>Replacement</th>
</tr>
<tr>
<td colspan="2" align="center">
<code>[&hellip;]</code>
</td>
</tr>
<tr>
<td><code>%y</code></td>
<td>The last two decimal digits of the year. If the result is a single digit it is prefixed by <code>0</code>.
<ins>The modified command <code>%Oy</code> produces the locale's
alternative representation. The modified command <code>%Ey</code> produces the locale's alternative
representation of offset from <code>%EC</code> (year only).</ins></td>
</tr>
<tr>
<td><code>%Y</code></td>
<td>The year as a decimal number. If the result is less than four digits it is left-padded
with <code>0</code> to four digits. <ins>The modified command <code>%EY</code> produces the locale's
alternative full year representation.</ins></td>
</tr>
<tr>
<td colspan="2" align="center">
<code>[&hellip;]</code>
</td>
</tr>
</table>

</blockquote>

</li>
</ol>




</body>
</html>
