Skip to content

Commit

Permalink
add documentation for %Z quirk
Browse files Browse the repository at this point in the history
  • Loading branch information
campbellcole authored and djc committed May 7, 2023
1 parent 35b145b commit e3bca27
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/format/strftime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The following specifiers are available both to formatting and parsing.
| `%r` | `12:34:60 AM` | Hour-minute-second format in 12-hour clocks. Same as `%I:%M:%S %p`. |
| | | |
| | | **TIME ZONE SPECIFIERS:** |
| `%Z` | `ACST` | Local time zone name. Skips all non-whitespace characters during parsing. [^8] |
| `%Z` | `ACST` | Local time zone name. Skips all non-whitespace characters during parsing. Identical to `%:z` when formatting. [^8] |
| `%z` | `+0930` | Offset from the local time to UTC (with UTC being `+0000`). |
| `%:z` | `+09:30` | Same as `%z` but with a colon. |
|`%::z`|`+09:30:00`| Offset from the local time to UTC with seconds. |
Expand Down Expand Up @@ -164,6 +164,12 @@ Notes:
Note that they can read nothing if the fractional part is zero.
[^8]: `%Z`:
Since `chrono` is not aware of timezones beyond their offsets, this specifier
**only prints the offset** when used for formatting. The timezone abbreviation
will NOT be printed. See [this issue](https://github.com/chronotope/chrono/issues/960)
for more information.
<br>
<br>
Offset will not be populated from the parsed data, nor will it be validated.
Timezone is completely ignored. Similar to the glibc `strptime` treatment of
this format code.
Expand Down

0 comments on commit e3bca27

Please sign in to comment.