This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

259
cppdraft/time/parse.md Normal file
View File

@@ -0,0 +1,259 @@
[time.parse]
# 30 Time library [[time]](./#time)
## 30.13 Parsing [time.parse]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11031)
Each parse overload specified in this subclause
calls from_stream unqualified,
so as to enable argument-dependent lookup ([[basic.lookup.argdep]](basic.lookup.argdep "6.5.4Argument-dependent name lookup"))[.](#1.sentence-1)
In the following paragraphs,
let is denote an object of type basic_istream<charT, traits> and
let I be basic_istream<charT, traits>&,
where charT and traits are template parameters in that context[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11040)
*Recommended practice*: Implementations should make it difficult to accidentally store or use
a manipulator that may contain a dangling reference to a format string,
for example by making the manipulators produced by parse immovable and
preventing stream extraction into an lvalue of such a manipulator type[.](#2.sentence-1)
[🔗](#itemdecl:1)
`template<class charT, class Parsable>
unspecified
parse(const charT* fmt, Parsable& tp);
template<class charT, class traits, class Alloc, class Parsable>
unspecified
parse(const basic_string<charT, traits, Alloc>& fmt, Parsable& tp);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11057)
Let F be fmt for the first overload andfmt.c_str() for the second overload[.](#3.sentence-1)
Let traits be char_traits<charT> for the first overload[.](#3.sentence-2)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11062)
*Constraints*: The expressionfrom_stream(declval<basic_istream<charT, traits>&>(), F, tp) is well-formed when treated as an [unevaluated operand](expr.context#def:unevaluated_operand "7.2.3Context dependence[expr.context]")[.](#4.sentence-1)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11070)
*Returns*: A manipulator such that
the expression is >> parse(fmt, tp) has type I,
has value is, and
calls from_stream(is, F, tp)[.](#5.sentence-1)
[🔗](#itemdecl:2)
`template<class charT, class traits, class Alloc, class Parsable>
unspecified
parse(const charT* fmt, Parsable& tp,
basic_string<charT, traits, Alloc>& abbrev);
template<class charT, class traits, class Alloc, class Parsable>
unspecified
parse(const basic_string<charT, traits, Alloc>& fmt, Parsable& tp,
basic_string<charT, traits, Alloc>& abbrev);
`
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11091)
Let F be fmt for the first overload andfmt.c_str() for the second overload[.](#6.sentence-1)
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11095)
*Constraints*: The expressionfrom_stream(declval<basic_istream<charT, traits>&>(), F, tp, addressof(abbrev)) is well-formed when treated as an [unevaluated operand](expr.context#def:unevaluated_operand "7.2.3Context dependence[expr.context]")[.](#7.sentence-1)
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11103)
*Returns*: A manipulator such that
the expression is >> parse(fmt, tp, abbrev) has type I,
has value is, and
calls from_stream(is, F, tp, addressof(abbrev))[.](#8.sentence-1)
[🔗](#itemdecl:3)
`template<class charT, class Parsable>
unspecified
parse(const charT* fmt, Parsable& tp, minutes& offset);
template<class charT, class traits, class Alloc, class Parsable>
unspecified
parse(const basic_string<charT, traits, Alloc>& fmt, Parsable& tp,
minutes& offset);
`
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11123)
Let F be fmt for the first overload andfmt.c_str() for the second overload[.](#9.sentence-1)
Let traits be char_traits<charT> andAlloc be allocator<charT> for the first overload[.](#9.sentence-2)
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11129)
*Constraints*: The expressionfrom_stream(declval<basic_istream<charT, traits>&>(), F, tp,
declval<basic_string<charT, traits, Alloc>*>(), &offset) is well-formed when treated as an [unevaluated operand](expr.context#def:unevaluated_operand "7.2.3Context dependence[expr.context]")[.](#10.sentence-1)
[11](#11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11140)
*Returns*: A manipulator such that
the expression is >> parse(fmt, tp, offset) has type I,
has value is, and
calls:from_stream(is, F, tp, static_cast<basic_string<charT, traits, Alloc>*>(nullptr), &offset)
[🔗](#itemdecl:4)
`template<class charT, class traits, class Alloc, class Parsable>
unspecified
parse(const charT* fmt, Parsable& tp,
basic_string<charT, traits, Alloc>& abbrev, minutes& offset);
template<class charT, class traits, class Alloc, class Parsable>
unspecified
parse(const basic_string<charT, traits, Alloc>& fmt, Parsable& tp,
basic_string<charT, traits, Alloc>& abbrev, minutes& offset);
`
[12](#12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11167)
Let F be fmt for the first overload andfmt.c_str() for the second overload[.](#12.sentence-1)
[13](#13)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11171)
*Constraints*: The expressionfrom_stream(declval<basic_istream<charT, traits>&>(), F, tp, addressof(abbrev), &offset) is well-formed when treated as an [unevaluated operand](expr.context#def:unevaluated_operand "7.2.3Context dependence[expr.context]")[.](#13.sentence-1)
[14](#14)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11180)
*Returns*: A manipulator such that
the expression is >> parse(fmt, tp, abbrev, offset) has type I,
has value is, and
calls from_stream(is, F, tp, addressof(abbrev), &offset)[.](#14.sentence-1)
[15](#15)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11189)
All from_stream overloads behave as unformatted input functions,
except that they have an unspecified effect
on the value returned by subsequent calls to basic_istream<>::gcount()[.](#15.sentence-1)
Each overload takes a format string containing ordinary characters
and flags which have special meaning[.](#15.sentence-2)
Each flag begins with a %[.](#15.sentence-3)
Some flags can be modified by E or O[.](#15.sentence-4)
During parsing each flag interprets characters as parts of date and time types
according to Table [134](#tab:time.parse.spec "Table 134: Meaning of parse flags")[.](#15.sentence-5)
Some flags can be modified by a width parameter
given as a positive decimal integer called out as *N* below
which governs how many characters are parsed from the stream in interpreting the flag[.](#15.sentence-6)
All characters in the format string that are not represented in Table [134](#tab:time.parse.spec "Table 134: Meaning of parse flags"),
except for whitespace, are parsed unchanged from the stream[.](#15.sentence-7)
A whitespace character matches zero or more whitespace characters in the input stream[.](#15.sentence-8)
[16](#16)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11206)
If the type being parsed cannot represent
the information that the format flag refers to,is.setstate(ios_base::failbit) is called[.](#16.sentence-1)
[*Example [1](#example-1)*:
A duration cannot represent a weekday[.](#16.sentence-2)
— *end example*]
However, if a flag refers to a “time of day”
(e.g., %H, %I, %p, etc[.](#16.sentence-3))
,
then a specialization of duration is parsed as
the time of day elapsed since midnight[.](#16.sentence-4)
[17](#17)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L11218)
If the from_stream overload fails to parse
everything specified by the format string,
or if insufficient information is parsed to specify a complete
duration, time point, or calendrical data structure,setstate(ios_base::failbit) is called on the basic_istream[.](#17.sentence-1)
Table [134](#tab:time.parse.spec) — Meaning of parse flags [[tab:time.parse.spec]](./tab:time.parse.spec)
| [🔗](#tab:time.parse.spec-row-1)<br>**Flag** | **Parsed value** |
| --- | --- |
| [🔗](#tab:time.parse.spec-row-2)<br>%a | The locale's full or abbreviated case-insensitive weekday name[.](#tab:time.parse.spec-row-2-column-2-sentence-1) |
| [🔗](#tab:time.parse.spec-row-3)<br>%A | Equivalent to %a[.](#tab:time.parse.spec-row-3-column-2-sentence-1) |
| [🔗](#tab:time.parse.spec-row-4)<br>%b | The locale's full or abbreviated case-insensitive month name[.](#tab:time.parse.spec-row-4-column-2-sentence-1) |
| [🔗](#tab:time.parse.spec-row-5)<br>%B | Equivalent to %b[.](#tab:time.parse.spec-row-5-column-2-sentence-1) |
| [🔗](#tab:time.parse.spec-row-6)<br>%c | The locale's date and time representation[.](#tab:time.parse.spec-row-6-column-2-sentence-1)<br>The modified command %Ec interprets the locale's alternate date and time representation[.](#tab:time.parse.spec-row-6-column-2-sentence-2) |
| [🔗](#tab:time.parse.spec-row-7)<br>%C | The century as a decimal number[.](#tab:time.parse.spec-row-7-column-2-sentence-1)<br>The modified command %*N*C specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-7-column-2-sentence-2)<br>If *N* is not specified, the default is 2[.](#tab:time.parse.spec-row-7-column-2-sentence-3)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-7-column-2-sentence-4)<br>The modified command %EC interprets the locale's alternative representation of the century[.](#tab:time.parse.spec-row-7-column-2-sentence-5) |
| [🔗](#tab:time.parse.spec-row-8)<br>%d | The day of the month as a decimal number[.](#tab:time.parse.spec-row-8-column-2-sentence-1)<br>The modified command %*N*d specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-8-column-2-sentence-2)<br>If *N* is not specified, the default is 2[.](#tab:time.parse.spec-row-8-column-2-sentence-3)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-8-column-2-sentence-4)<br>The modified command %Od interprets the locale's alternative representation of the day of the month[.](#tab:time.parse.spec-row-8-column-2-sentence-5) |
| [🔗](#tab:time.parse.spec-row-9)<br>%D | Equivalent to %m/%d/%y[.](#tab:time.parse.spec-row-9-column-2-sentence-1) |
| [🔗](#tab:time.parse.spec-row-10)<br>%e | Equivalent to %d and can be modified like %d[.](#tab:time.parse.spec-row-10-column-2-sentence-1) |
| [🔗](#tab:time.parse.spec-row-11)<br>%F | Equivalent to %Y-%m-%d[.](#tab:time.parse.spec-row-11-column-2-sentence-1)<br>If modified with a width *N*, the width is applied to only %Y[.](#tab:time.parse.spec-row-11-column-2-sentence-2) |
| [🔗](#tab:time.parse.spec-row-12)<br>%g | The last two decimal digits of the calendar year, as specified in ISO 8601-1:2019 for the week calendar[.](#tab:time.parse.spec-row-12-column-2-sentence-1)<br>The modified command %*N*g specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-12-column-2-sentence-2)<br>If *N* is not specified, the default is 2[.](#tab:time.parse.spec-row-12-column-2-sentence-3)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-12-column-2-sentence-4) |
| [🔗](#tab:time.parse.spec-row-13)<br>%G | The calendar year as a decimal number, as specified in ISO 8601-1:2019 for the week calendar[.](#tab:time.parse.spec-row-13-column-2-sentence-1)<br>The modified command %*N*G specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-13-column-2-sentence-2)<br>If *N* is not specified, the default is 4[.](#tab:time.parse.spec-row-13-column-2-sentence-3)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-13-column-2-sentence-4) |
| [🔗](#tab:time.parse.spec-row-14)<br>%h | Equivalent to %b[.](#tab:time.parse.spec-row-14-column-2-sentence-1) |
| [🔗](#tab:time.parse.spec-row-15)<br>%H | The hour (24-hour clock) as a decimal number[.](#tab:time.parse.spec-row-15-column-2-sentence-1)<br>The modified command %*N*H specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-15-column-2-sentence-2)<br>If *N* is not specified, the default is 2[.](#tab:time.parse.spec-row-15-column-2-sentence-3)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-15-column-2-sentence-4)<br>The modified command %OH interprets the locale's alternative representation[.](#tab:time.parse.spec-row-15-column-2-sentence-5) |
| [🔗](#tab:time.parse.spec-row-16)<br>%I | The hour (12-hour clock) as a decimal number[.](#tab:time.parse.spec-row-16-column-2-sentence-1)<br>The modified command %*N*I specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-16-column-2-sentence-2)<br>If *N* is not specified, the default is 2[.](#tab:time.parse.spec-row-16-column-2-sentence-3)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-16-column-2-sentence-4)<br>The modified command %OI interprets the locale's alternative representation[.](#tab:time.parse.spec-row-16-column-2-sentence-5) |
| [🔗](#tab:time.parse.spec-row-17)<br>%j | If the type being parsed is a specialization of duration, a decimal number of days[.](#tab:time.parse.spec-row-17-column-2-sentence-1)<br>Otherwise, the day of the year as a decimal number[.](#tab:time.parse.spec-row-17-column-2-sentence-2)<br>January 1 is 1[.](#tab:time.parse.spec-row-17-column-2-sentence-3)<br>In either case, the modified command %*N*j specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-17-column-2-sentence-4)<br>If *N* is not specified, the default is 3[.](#tab:time.parse.spec-row-17-column-2-sentence-5)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-17-column-2-sentence-6) |
| [🔗](#tab:time.parse.spec-row-18)<br>%m | The month as a decimal number[.](#tab:time.parse.spec-row-18-column-2-sentence-1)<br>January is 1[.](#tab:time.parse.spec-row-18-column-2-sentence-2)<br>The modified command %*N*m specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-18-column-2-sentence-3)<br>If *N* is not specified, the default is 2[.](#tab:time.parse.spec-row-18-column-2-sentence-4)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-18-column-2-sentence-5)<br>The modified command %Om interprets the locale's alternative representation[.](#tab:time.parse.spec-row-18-column-2-sentence-6) |
| [🔗](#tab:time.parse.spec-row-19)<br>%M | The minutes as a decimal number[.](#tab:time.parse.spec-row-19-column-2-sentence-1)<br>The modified command %*N*M specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-19-column-2-sentence-2)<br>If *N* is not specified, the default is 2[.](#tab:time.parse.spec-row-19-column-2-sentence-3)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-19-column-2-sentence-4)<br>The modified command %OM interprets the locale's alternative representation[.](#tab:time.parse.spec-row-19-column-2-sentence-5) |
| [🔗](#tab:time.parse.spec-row-20)<br>%n | Matches one whitespace character[.](#tab:time.parse.spec-row-20-column-2-sentence-1)<br>[*Note [1](#tab:time.parse.spec-row-20-column-2-note-1)*:<br>%n, %t, and a space can be combined to match a wide range of whitespace patterns[.](#tab:time.parse.spec-row-20-column-2-sentence-2)<br>For example, "%n " matches one or more whitespace characters, and "%n%t%t" matches one to three whitespace characters[.](#tab:time.parse.spec-row-20-column-2-sentence-3) — *end note*] |
| [🔗](#tab:time.parse.spec-row-21)<br>%p | The locale's equivalent of the AM/PM designations associated with a 12-hour clock[.](#tab:time.parse.spec-row-21-column-2-sentence-1) |
| [🔗](#tab:time.parse.spec-row-22)<br>%r | The locale's 12-hour clock time[.](#tab:time.parse.spec-row-22-column-2-sentence-1) |
| [🔗](#tab:time.parse.spec-row-23)<br>%R | Equivalent to %H:%M[.](#tab:time.parse.spec-row-23-column-2-sentence-1) |
| [🔗](#tab:time.parse.spec-row-24)<br>%S | The seconds as a decimal number[.](#tab:time.parse.spec-row-24-column-2-sentence-1)<br>The modified command %*N*S specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-24-column-2-sentence-2)<br>If *N* is not specified, the default is 2 if the input time has a precision convertible to seconds[.](#tab:time.parse.spec-row-24-column-2-sentence-3)<br>Otherwise the default width is determined by the decimal precision of the input and the field is interpreted as a long double in a fixed format[.](#tab:time.parse.spec-row-24-column-2-sentence-4)<br>If encountered, the locale determines the decimal point character[.](#tab:time.parse.spec-row-24-column-2-sentence-5)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-24-column-2-sentence-6)<br>The modified command %OS interprets the locale's alternative representation[.](#tab:time.parse.spec-row-24-column-2-sentence-7) |
| [🔗](#tab:time.parse.spec-row-25)<br>%t | Matches zero or one whitespace characters[.](#tab:time.parse.spec-row-25-column-2-sentence-1) |
| [🔗](#tab:time.parse.spec-row-26)<br>%T | Equivalent to %H:%M:%S[.](#tab:time.parse.spec-row-26-column-2-sentence-1) |
| [🔗](#tab:time.parse.spec-row-27)<br>%u | The calendar day of week as a decimal number (1-7), as specified in ISO 8601-1:2019, where Monday is 1[.](#tab:time.parse.spec-row-27-column-2-sentence-1)<br>The modified command %*N*u specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-27-column-2-sentence-2)<br>If *N* is not specified, the default is 1[.](#tab:time.parse.spec-row-27-column-2-sentence-3)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-27-column-2-sentence-4) |
| [🔗](#tab:time.parse.spec-row-28)<br>%U | The week number of the year as a decimal number[.](#tab:time.parse.spec-row-28-column-2-sentence-1)<br>The first Sunday of the year is the first day of week 01[.](#tab:time.parse.spec-row-28-column-2-sentence-2)<br>Days of the same year prior to that are in week 00[.](#tab:time.parse.spec-row-28-column-2-sentence-3)<br>The modified command %*N*U specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-28-column-2-sentence-4)<br>If *N* is not specified, the default is 2[.](#tab:time.parse.spec-row-28-column-2-sentence-5)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-28-column-2-sentence-6)<br>The modified command %OU interprets the locale's alternative representation[.](#tab:time.parse.spec-row-28-column-2-sentence-7) |
| [🔗](#tab:time.parse.spec-row-29)<br>%V | The calendar week of year as a decimal number, as specified in ISO 8601-1:2019 for the week calendar[.](#tab:time.parse.spec-row-29-column-2-sentence-1)<br>The modified command %*N*V specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-29-column-2-sentence-2)<br>If *N* is not specified, the default is 2[.](#tab:time.parse.spec-row-29-column-2-sentence-3)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-29-column-2-sentence-4) |
| [🔗](#tab:time.parse.spec-row-30)<br>%w | The weekday as a decimal number (0-6), where Sunday is 0[.](#tab:time.parse.spec-row-30-column-2-sentence-1)<br>The modified command %*N*w specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-30-column-2-sentence-2)<br>If *N* is not specified, the default is 1[.](#tab:time.parse.spec-row-30-column-2-sentence-3)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-30-column-2-sentence-4)<br>The modified command %Ow interprets the locale's alternative representation[.](#tab:time.parse.spec-row-30-column-2-sentence-5) |
| [🔗](#tab:time.parse.spec-row-31)<br>%W | The week number of the year as a decimal number[.](#tab:time.parse.spec-row-31-column-2-sentence-1)<br>The first Monday of the year is the first day of week 01[.](#tab:time.parse.spec-row-31-column-2-sentence-2)<br>Days of the same year prior to that are in week 00[.](#tab:time.parse.spec-row-31-column-2-sentence-3)<br>The modified command %*N*W specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-31-column-2-sentence-4)<br>If *N* is not specified, the default is 2[.](#tab:time.parse.spec-row-31-column-2-sentence-5)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-31-column-2-sentence-6)<br>The modified command %OW interprets the locale's alternative representation[.](#tab:time.parse.spec-row-31-column-2-sentence-7) |
| [🔗](#tab:time.parse.spec-row-32)<br>%x | The locale's date representation[.](#tab:time.parse.spec-row-32-column-2-sentence-1)<br>The modified command %Ex interprets the locale's alternate date representation[.](#tab:time.parse.spec-row-32-column-2-sentence-2) |
| [🔗](#tab:time.parse.spec-row-33)<br>%X | The locale's time representation[.](#tab:time.parse.spec-row-33-column-2-sentence-1)<br>The modified command %EX interprets the locale's alternate time representation[.](#tab:time.parse.spec-row-33-column-2-sentence-2) |
| [🔗](#tab:time.parse.spec-row-34)<br>%y | The last two decimal digits of the year[.](#tab:time.parse.spec-row-34-column-2-sentence-1)<br>If the century is not otherwise specified (e.g., with %C), values in the range [69, 99] are presumed to refer to the years 1969 to 1999, and values in the range [00, 68] are presumed to refer to the years 2000 to 2068[.](#tab:time.parse.spec-row-34-column-2-sentence-2)<br>The modified command %*N*y specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-34-column-2-sentence-3)<br>If *N* is not specified, the default is 2[.](#tab:time.parse.spec-row-34-column-2-sentence-4)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-34-column-2-sentence-5)<br>The modified commands %Ey and %Oy interpret the locale's alternative representation[.](#tab:time.parse.spec-row-34-column-2-sentence-6) |
| [🔗](#tab:time.parse.spec-row-35)<br>%Y | The year as a decimal number[.](#tab:time.parse.spec-row-35-column-2-sentence-1)<br>The modified command %*N*Y specifies the maximum number of characters to read[.](#tab:time.parse.spec-row-35-column-2-sentence-2)<br>If *N* is not specified, the default is 4[.](#tab:time.parse.spec-row-35-column-2-sentence-3)<br>Leading zeroes are permitted but not required[.](#tab:time.parse.spec-row-35-column-2-sentence-4)<br>The modified command %EY interprets the locale's alternative representation[.](#tab:time.parse.spec-row-35-column-2-sentence-5) |
| [🔗](#tab:time.parse.spec-row-36)<br>%z | The offset from UTC in the format [+|-]hh[mm][.](#tab:time.parse.spec-row-36-column-2-sentence-1)<br>For example -0430 refers to 4 hours 30 minutes behind UTC, and 04 refers to 4 hours ahead of UTC[.](#tab:time.parse.spec-row-36-column-2-sentence-2)<br>The modified commands %Ez and %Oz parse a : between the hours and minutes and render leading zeroes on the hour field optional: [+|-]h[h][:mm][.](#tab:time.parse.spec-row-36-column-2-sentence-3)<br>For example -04:30 refers to 4 hours 30 minutes behind UTC, and 4 refers to 4 hours ahead of UTC[.](#tab:time.parse.spec-row-36-column-2-sentence-4) |
| [🔗](#tab:time.parse.spec-row-37)<br>%Z | The time zone abbreviation or name[.](#tab:time.parse.spec-row-37-column-2-sentence-1)<br>A single word is parsed[.](#tab:time.parse.spec-row-37-column-2-sentence-2)<br>This word can only contain characters from the basic character set ([[lex.charset]](lex.charset "5.3.1Character sets")) that are alphanumeric, or one of '_', '/', '-', or '+'[.](#tab:time.parse.spec-row-37-column-2-sentence-3) |
| [🔗](#tab:time.parse.spec-row-38)<br>%% | A % character is extracted[.](#tab:time.parse.spec-row-38-column-2-sentence-1) |