Skip to content

Commit 2cbca9a

Browse files
committed
nicer considerations block
1 parent b9ad57a commit 2cbca9a

File tree

1 file changed

+72
-61
lines changed

1 file changed

+72
-61
lines changed

modules/ROOT/pages/functions/temporal/format.adoc

Lines changed: 72 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -74,83 +74,94 @@ Most characters change yield a different output when they are repeated.
7474
|===
7575

7676
.Considerations
77-
|===
78-
79-
| Some characters cannot be applied to certain types, for instance, `u` cannot be used to construct a string for a `LOCAL TIME` because it represents a year which is not part of the temporal value.
80-
81-
| The "text" presentation is determined by how often the pattern character is repeated: less than 4 characters result in the short form ("AD"). Exactly 4 characters result in the full form ("Anno Domini"). Exactly 5 characters result in the narrow form ("A").
77+
[caption=""]
78+
======
8279
83-
The characters 'L', 'q', and 'c' represent the standalone form of the text presentation.
80+
* Some characters cannot be applied to certain types, for instance, `u` cannot be used to construct a string for a `LOCAL TIME` because it represents a year which is not part of the temporal value.
8481
85-
| A single "number" character outputs the minimum number of digits without padding. With more "number" characters, the number of digits is used as the width of the output field, with the value zero-padded as necessary.
82+
* The **text** presentation is determined by how often the pattern character is repeated: less than 4 characters result in the short form ("AD"). Exactly 4 characters result in the full form ("Anno Domini"). Exactly 5 characters result in the narrow form ("A").
83+
+
84+
The characters `L`, `q`, and `c` represent the standalone form of the text presentation.
8685
86+
* A single **number** character outputs the minimum number of digits without padding. With more **number** characters, the number of digits is used as the width of the output field, with the value zero-padded as necessary.
87+
+
8788
The following characters have constraints on the count of letters:
89+
+
90+
Only a single `c` or `F` can be specified.
91+
+
92+
Up to two `d`, `H`, `h`, `K`, `k`, `m`, and `s` can be specified.
93+
+
94+
Up to three `D` can be specified.
8895
89-
Only one letter of 'c' and 'F' can be specified.
90-
91-
Up to two letters of 'd', 'H', 'h', 'K', 'k', 'm', and 's' can be specified.
92-
93-
Up to three letters of 'D' can be specified.
94-
95-
| If the number of characters in a "number/text" is 3 or greater, use the text rules, otherwise the number rules.
96-
97-
| A "fraction" outputs the nano-of-second field as a fraction-of-second. The nano-of-second value has nine digits, thus the number of characters can be between 1 and 9 and is truncated if it is less than 9.
96+
* If the number of characters in a **number/text** is three or greater, use the text rules, otherwise the number rules.
9897
99-
| The "year" characters determine the minimum field width below which padding is used.
98+
* A **fraction** outputs the nano-of-second field as a fraction-of-second.
99+
The nano-of-second value has nine digits, thus the number of characters can be between 1 and 9 and is truncated if it is less than 9.
100100
101+
* The **year** characters determine the minimum field width below which padding is used.
102+
+
101103
With two characters, the reduced two digit form is used. For printing, this outputs the rightmost two digits. For parsing, this will use the base value of 2000, resulting in a year within the range of 2000 and 2099.
102-
104+
+
103105
With one or three characters, the minus-sign is only output for negative years. Otherwise, the minus-sign is output if the pad width is exceeded.
104106
105-
| A "zone-id" outputs the timezone ID. Two characters output the timezone ID, other amounts result in an error.
106-
107-
| A "zone-name" outputs the display name of the timezone ID.
108-
109-
If the pattern character is 'z', the output is the daylight saving time (DST) zone name. If there is insufficient information to determine whether DST applies, the name ignoring daylight saving time will be used.One, two or three characters output the short name, four characters output the full name, and five or more result in an error.
110-
111-
If the character is 'v', the output provides the zone name ignoring daylight saving time.
112-
One 'v' outputs the short name, two three and five result in an error, and four 'v's output the full name.
113-
114-
| "offset-X" and "offset-x" format the offset based on the number of pattern characters.
115-
One character outputs just the hour, such as '+01', unless the minute is non-zero. In that case, the minute is also output, such as '+0130'.
116-
117-
Two characters output the hour and minute, without a colon, such as '+0130'.
118-
119-
Three characters output the hour and minute, with a colon, such as '+01:30'.
120-
121-
Four letters outputs the hour and minute and optional second, without a colon, such as '+013015'.
122-
123-
Five letters outputs the hour and minute and optional second, with a colon, such as '+01:30:15'.
124-
125-
Six or more letters result in an error.
126-
127-
An upper case 'X' outputs 'Z' if the offset would be zero, whereas a lowwer case 'x' outputs '+00', '+0000', or '+00:00'.
128-
129-
| With a non-zero offset, "offset-O" formats the localized offset based on the number of characters.
130-
131-
One character outputs the short form of the localized offset, which is the localized offset text, such as 'GMT', followed by the hour without leading zero, optional 2-digit minute and second if they are non-zero, and a colon, for example 'GMT+8'.
132-
133-
Four characters output the full form, which is a localized offset text, such as 'GMT, with a 2-digit hour and minute field, optional second field if non-zero, and colon, for example 'GMT+08:00'.
134-
135-
If the offset is zero, only localized text is output.
136-
107+
* A **zone-id** outputs the timezone ID. Two characters output the timezone ID, other amounts result in an error.
108+
109+
* A **zone-name** outputs the display name of the timezone ID.
110+
+
111+
If the pattern character is `z`, the output is the daylight saving time (DST) zone name.
112+
If there is insufficient information to determine whether DST applies, the name ignoring daylight saving time will be used.
113+
+
114+
One, two or three characters output the short name, four characters output the full name, and five or more result in an error.
115+
+
116+
If the character is `v`, the output provides the zone name ignoring daylight saving time.
117+
One `v` outputs the short name, two three and five result in an error, and four `v` output the full name.
118+
119+
* **offset-X** and **offset-x** format the offset based on the number of pattern characters.
120+
One character outputs just the hour, like `+01`, unless the minute is non-zero.
121+
In that case, the minute is also output, like `+0130`.
122+
+
123+
Two characters output the hour and minute, without a colon, like `+0130`.
124+
+
125+
Three characters output the hour and minute, with a colon, like `+01:30`.
126+
+
127+
Four characters output the hour and minute and optional second, without a colon, like `+013015`.
128+
+
129+
Five characters output the hour and minute and optional second, with a colon, like `+01:30:15`.
130+
+
131+
Six or more characters result in an error.
132+
+
133+
An upper case `X` outputs `Z` if the offset is zero, whereas a lower case `x` outputs `+00`, `+0000`, or `+00:00`.
134+
135+
* With a non-zero offset, **offset-O** formats the localized offset based on the number of characters.
136+
+
137+
One character outputs the short form of the localized offset, which is the localized offset text, like `GMT`.
138+
It is followed by the hour without leading zero, optional 2-digit minute and second if they are non-zero, and a colon, for example `GMT+8`.
139+
+
140+
Four characters output the full form, which is a localized offset text with a 2-digit hour and minute field, optional second field if non-zero, and colon, for example `GMT+08:00`.
141+
+
142+
If the offset is zero, only the localized text is output.
143+
+
137144
Other character amounts result in an error.
138145
139-
| "offset-Z" formats the offset based on the number of characters.
140-
141-
One, two or three characters output the hour and minute, without a colon, such as '+0130'. If the offset is zero, the output will be '+0000'.
142-
143-
Four characters outputs the full form of the localized offset, equivalent to four characters of "offset-O". If the offset is zero, the output will be the corresponding localized offset text.
144-
145-
Five characters output the hour, minute, with optional second if non-zero, with colon. If the offset is zero, the output is 'Z'.
146-
146+
* **offset-Z** formats the offset based on the number of characters.
147+
+
148+
One, two or three characters output the hour and minute, without a colon, such as `+0130`.
149+
If the offset is zero, the output will be `+0000`.
150+
+
151+
Four characters outputs the full form of the localized offset, equivalent to four characters of **offset-O**.
152+
If the offset is zero, the output will be the corresponding localized offset text.
153+
+
154+
Five characters output the hour, minute, with optional second if non-zero, with colon. If the offset is zero, the output is `Z`.
155+
+
147156
More characters will result in an error.
148157
149-
| The "pad modifier" modifies the pattern that immediately follows to be padded with spaces. The pad width is determined by the number of pattern characters.
158+
* The **pad modifier** modifies the pattern that immediately follows to be padded with spaces.
159+
The pad width is determined by the number of pattern characters.
150160
151-
| Any character that is not reserved, other than '[', ']', '{', '}', '#', and the single quote are output directly. To ensure future compatibility it is recommended to wrap all characters that you want to output directly with single quotes.
161+
* Any character that is not reserved, other than `[`, `]`, `{`, `}`, `#`, and `'` are output directly.
162+
To ensure future compatibility it is recommended to wrap all characters that you want to output directly with single quotes.
152163
153-
|===
164+
======
154165

155166
.Instance formatting with year, month, day, hour, minute, second, fraction-of-second and zone-offset
156167
======

0 commit comments

Comments
 (0)