From d2e89c8b080394e996d449371267365c223ca76b Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 8 Nov 2022 19:35:34 -1000 Subject: [PATCH] Document more chrono specs --- doc/syntax.rst | 82 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 72 insertions(+), 10 deletions(-) diff --git a/doc/syntax.rst b/doc/syntax.rst index d42700b4..e627f02f 100644 --- a/doc/syntax.rst +++ b/doc/syntax.rst @@ -326,26 +326,27 @@ The available presentation types (*chrono_type*) are: +---------+--------------------------------------------------------------------+ | Type | Meaning | +=========+====================================================================+ -| ``'a'`` | The abbreviated weekday name e.g. "Sat". If the value does not | +| ``'a'`` | The abbreviated weekday name, e.g. "Sat". If the value does not | | | contain a valid weekday, an exception of type ``format_error`` is | | | thrown. | +---------+--------------------------------------------------------------------+ -| ``'A'`` | The full weekday name e.g. "Saturday". If the value does not | +| ``'A'`` | The full weekday name, e.g. "Saturday". If the value does not | | | contain a valid weekday, an exception of type ``format_error`` is | | | thrown. | +---------+--------------------------------------------------------------------+ -| ``'b'`` | The abbreviated month name e.g. "Nov". If the value does not | +| ``'b'`` | The abbreviated month name, e.g. "Nov". If the value does not | | | contain a valid month, an exception of type ``format_error`` is | | | thrown. | +---------+--------------------------------------------------------------------+ -| ``'B'`` | The full month name e.g. "November". If the value does not contain | -| | a valid month, an exception of type ``format_error`` is thrown. | +| ``'B'`` | The full month name, e.g. "November". If the value does not | +| | contain a valid month, an exception of type ``format_error`` is | +| | thrown. | +---------+--------------------------------------------------------------------+ -| ``'c'`` | The date and time representation e.g. "Sat Nov 12 22:04:00 1955". | +| ``'c'`` | The date and time representation, e.g. "Sat Nov 12 22:04:00 1955". | | | The modified command ``%Ec`` produces the locale's alternate date | | | and time representation. | +---------+--------------------------------------------------------------------+ -| ``'C'`` | The year divided by 100 using floored division e.g. "55". If the | +| ``'C'`` | The year divided by 100 using floored division, e.g. "55". If the | | | result is a single decimal digit, it is prefixed with 0. | | | The modified command ``%EC`` produces the locale's alternative | | | representation of the century. | @@ -354,13 +355,13 @@ The available presentation types (*chrono_type*) are: | | decimal digit, it is prefixed with 0. The modified command ``%Od`` | | | produces the locale's alternative representation. | +---------+--------------------------------------------------------------------+ -| ``'D'`` | Equivalent to ``%m/%d/%y`` e.g. "11/12/55". | +| ``'D'`` | Equivalent to ``%m/%d/%y``, e.g. "11/12/55". | +---------+--------------------------------------------------------------------+ | ``'e'`` | The day of month as a decimal number. If the result is a single | | | decimal digit, it is prefixed with a space. The modified command | | | ``%Oe`` produces the locale's alternative representation. | +---------+--------------------------------------------------------------------+ -| ``'F'`` | Equivalent to ``%Y-%m-%d`` e.g. "1955-11-12". | +| ``'F'`` | Equivalent to ``%Y-%m-%d``, e.g. "1955-11-12". | +---------+--------------------------------------------------------------------+ | ``'g'`` | The last two decimal digits of the ISO week-based year. If the | | | result is a single digit it is prefixed by 0. | @@ -368,7 +369,7 @@ The available presentation types (*chrono_type*) are: | ``'G'`` | The ISO week-based year as a decimal number. If the result is less | | | than four digits it is left-padded with 0 to four digits. | +---------+--------------------------------------------------------------------+ -| ``'h'`` | Equivalent to ``%b`` e.g. "Nov". | +| ``'h'`` | Equivalent to ``%b``, e.g. "Nov". | +---------+--------------------------------------------------------------------+ | ``'H'`` | The hour (24-hour clock) as a decimal number. If the result is a | | | single digit, it is prefixed with 0. The modified command ``%OH`` | @@ -399,6 +400,10 @@ The available presentation types (*chrono_type*) are: +---------+--------------------------------------------------------------------+ | ``'Q'`` | The duration's numeric value (as if extracted via ``.count()``). | +---------+--------------------------------------------------------------------+ +| ``'r'`` | The 12-hour clock time, e.g. "10:04:00 PM". | ++---------+--------------------------------------------------------------------+ +| ``'R'`` | Equivalent to ``%H:%M``, e.g. "22:04". | ++---------+--------------------------------------------------------------------+ | ``'S'`` | Seconds as a decimal number. If the number of seconds is less than | | | 10, the result is prefixed with 0. If the precision of the input | | | cannot be exactly represented with seconds, then the format is a | @@ -409,6 +414,63 @@ The available presentation types (*chrono_type*) are: | | decimal point is localized according to the locale. The modified | | | command ``%OS`` produces the locale's alternative representation. | +---------+--------------------------------------------------------------------+ +| ``'t'`` | A horizontal-tab character. | ++---------+--------------------------------------------------------------------+ +| ``'T'`` | Equivalent to ``%H:%M:%S``. | ++---------+--------------------------------------------------------------------+ +| ``'u'`` | The ISO weekday as a decimal number (1-7), where Monday is 1. The | +| | modified command ``%Ou`` produces the locale's alternative | +| | representation. | ++---------+--------------------------------------------------------------------+ +| ``'U'`` | The week number of the year as a decimal number. The first Sunday | +| | of the year is the first day of week 01. Days of the same year | +| | prior to that are in week 00. If the result is a single digit, it | +| | is prefixed with 0. The modified command ``%OU`` produces the | +| | locale's alternative representation. | ++---------+--------------------------------------------------------------------+ +| ``'V'`` | The ISO week-based week number as a decimal number. If the result | +| | is a single digit, it is prefixed with 0. The modified command | +| | ``%OV`` produces the locale's alternative representation. | ++---------+--------------------------------------------------------------------+ +| ``'w'`` | The weekday as a decimal number (0-6), where Sunday is 0. | +| | The modified command ``%Ow`` produces the locale's alternative | +| | representation. | ++---------+--------------------------------------------------------------------+ +| ``'W'`` | The week number of the year as a decimal number. The first Monday | +| | of the year is the first day of week 01. Days of the same year | +| | prior to that are in week 00. If the result is a single digit, it | +| | is prefixed with 0. The modified command ``%OW`` produces the | +| | locale's alternative representation. | ++---------+--------------------------------------------------------------------+ +| ``'x'`` | The date representation, e.g. "11/12/55". The modified command | +| | ``%Ex`` produces the locale's alternate date representation. | ++---------+--------------------------------------------------------------------+ +| ``'X'`` | The time representation, e.g. "10:04:00". The modified command | +| | ``%EX`` produces the locale's alternate time representation. | ++---------+--------------------------------------------------------------------+ +| ``'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. | ++---------+--------------------------------------------------------------------+ +| ``'z'`` | The offset from UTC in the ISO 8601:2004 format. For example -0430 | +| | refers to 4 hours 30 minutes behind UTC. If the offset is zero, | +| | +0000 is used. The modified commands ``%Ez`` and ``%Oz`` insert a | +| | ``:`` between the hours and minutes: -04:30. If the offset | +| | information is not available, an exception of type | +| | ``format_error`` is thrown. | ++---------+--------------------------------------------------------------------+ +| ``'Z'`` | The time zone abbreviation. If the time zone abbreviation is not | +| | available, an exception of type ``format_error`` is thrown. | ++---------+--------------------------------------------------------------------+ +| ``'%'`` | A % character. | ++---------+--------------------------------------------------------------------+ Specifiers that have a calendaric component such as ``'d'`` (the day of month) are valid only for ``std::tm`` and time points but not durations.