时间格式
Date & Time Patterns
2019-10-12
Itsycal can optionally accept a datetime pattern which it will use to show the current date and/or time next to its icon in the menu bar. Here are some examples:
| Pattern | Result |
|---|---|
E, d-MMM H:mm |
Fri, 13-Jan 21:54 |
EEEE h:mm a |
Friday 9:54 PM |
The table below shows some of the most useful characters used in datetime patterns. Characters may be used multiple times. For example, if y is used for the year, yy might produce 17 whereas yyyy produces 2017. For most numerical fields, the number of characters specifies the field width. For example, if h is the hour, h might produce 5 but hh produces 05. For some characters, the count specifies whether an abbreviated or full form should be used.
| Symbol | Occurrences | Example | |
|---|---|---|---|
| Year | y |
1..n | 1996 |
| Month | M |
1..2 | 09 |
| 3 | Sept |
||
| 4 | September |
||
| 5 | S |
||
| Week of Year | w |
1..2 | 27 |
| Week of Month | W |
1 | 3 |
| Day of the Month | d |
1..2 | 31 |
| Day of the Week | E |
1..3 | Tues |
| 4 | Tuesday |
||
| 5 | T |
||
| AM or PM | a |
1 | AM |
| Hour [1-12] | h |
1..2 | 11 |
| Hour [0-23] | H |
1..2 | 13 |
| Minute | m |
1..2 | 59 |
| Second | s |
1..2 | 59 |
Two single quotes (eg. '') represents a literal single quote, either inside or outside single quotes. Text within single quotes is not interpreted in any way (eg. 'o''clock' is replaced with o'clock). Otherwise all ASCII letters from a-z and A-Z are reserved as syntax characters, and require quoting if they are to represent literal characters.
A full description of datetime patterns can be found in the Unicode Local Data Markup Language.



