Enum chrono::format::Numeric
[−]
[src]
pub enum Numeric { Year, YearDiv100, YearMod100, IsoYear, IsoYearDiv100, IsoYearMod100, Month, Day, WeekFromSun, WeekFromMon, IsoWeek, NumDaysFromSun, WeekdayFromMon, Ordinal, Hour, Hour12, Minute, Second, Nanosecond, Timestamp, }
Numeric item types. They have associated formatting width (FW) and parsing width (PW).
The formatting width is the minimal width to be formatted.
If the number is too short, and the padding is not Pad::None
, then it is left-padded.
If the number is too long or (in some cases) negative, it is printed as is.
The parsing width is the maximal width to be scanned. The parser only tries to consume from one to given number of digits (greedily). It also trims the preceding whitespaces if any. It cannot parse the negative number, so some date and time cannot be formatted then parsed with the same formatting items.
Variants
Year | Full Gregorian year (FW=4, PW=infinity). May accept years before 1 BCE or after 9999 CE, given an initial sign. |
YearDiv100 | Gregorian year divided by 100 (century number; FW=PW=2). Implies the non-negative year. |
YearMod100 | Gregorian year modulo 100 (FW=PW=2). Cannot be negative. |
IsoYear | Year in the ISO week date (FW=4, PW=infinity). May accept years before 1 BCE or after 9999 CE, given an initial sign. |
IsoYearDiv100 | Year in the ISO week date, divided by 100 (FW=PW=2). Implies the non-negative year. |
IsoYearMod100 | Year in the ISO week date, modulo 100 (FW=PW=2). Cannot be negative. |
Month | Month (FW=PW=2). |
Day | Day of the month (FW=PW=2). |
WeekFromSun | Week number, where the week 1 starts at the first Sunday of January (FW=PW=2). |
WeekFromMon | Week number, where the week 1 starts at the first Monday of January (FW=PW=2). |
IsoWeek | Week number in the ISO week date (FW=PW=2). |
NumDaysFromSun | Day of the week, where Sunday = 0 and Saturday = 6 (FW=PW=1). |
WeekdayFromMon | Day of the week, where Monday = 1 and Sunday = 7 (FW=PW=1). |
Ordinal | Day of the year (FW=PW=3). |
Hour | Hour number in the 24-hour clocks (FW=PW=2). |
Hour12 | Hour number in the 12-hour clocks (FW=PW=2). |
Minute | The number of minutes since the last whole hour (FW=PW=2). |
Second | The number of seconds since the last whole minute (FW=PW=2). |
Nanosecond | The number of nanoseconds since the last whole second (FW=PW=9).
Note that this is not left-aligned; see also |
Timestamp | The number of non-leap seconds since January 1, 1970 0:00:00 UTC (FW=1, PW=infinity). For formatting, it assumes UTC upon the absence of time zone offset. |