-
Notifications
You must be signed in to change notification settings - Fork 0
Date Formatting
Malakai Smith edited this page Aug 7, 2025
·
2 revisions
Under the hood, zshclock relies on strftime
* to calculate dates. Therefore, when formatting the date (either in a config file or in the command bar), zshclock permits all expansions as defined by strftime
.
* Provided by the zsh/datetime
built-in module, and so classifies as a "native zsh" command.
Format | Description | Example |
---|---|---|
%A |
Full weekday name | Saturday |
%a |
Abbreviated weekday name | Sat |
%B |
Full month name | July |
%b |
Abbreviated month name | Jul |
%C |
Century, leading zeroes | 20 |
%c |
National representation of time and date | Sat Jul 26 15:28:03 2025 |
%D |
Same as %m/%d/%y
|
07/26/25 |
%E* %0*
|
POSIX locale extensions | |
%e |
Day of the month (1-31) | 26 |
%F |
Same as %Y-%m-%d
|
2025-07-26 |
%G |
Year with century, Monday as week-start | 2025 |
%g |
Same as %G , but without century (00-99) |
25 |
%H |
Hour (00-23) | 15 |
%h |
Same as %b
|
Jul |
%I |
Hour (01-12) | 03 |
%j |
Day of the year (001-366) | 207 |
%k |
Hour (0-23) | 15 |
%l |
Hour (1-12) | 3 |
%M |
Minute (00-59) | 44 |
%m |
Month (01-12) | 07 |
%n |
Newline | |
%p |
AM /PM
|
PM |
%R |
Same as %H:%M
|
15:51 |
%r |
Same as %I:%M:%S %p
|
03:51:54 PM |
%S |
Second (00-59) | 54 |
%s |
Seconds since Epoch | 1753566884 |
%T |
Same as %H:%M:%S
|
15:56:04 |
%t |
Tab | |
%U |
Week of the year (00-53), Sunday as week-start | 29 |
%u |
Day of the week (1-7), Sunday as week-start | 6 |
%V |
Week of the year (01-53), Monday as week-start, if the week of Jan 1 has four or more days, it's week 1, otherwise the following week is week 1 | 30 |
%v |
Same as %e-%b-%Y
|
26-Jul-2025 |
%W |
Week of the year (00-53), Monday as week-start | 29 |
%w |
Day of the week (0-6), Sunday as week-start | 6 |
%X |
National representation of time | 16:14:27 |
%x |
National representation of date | 07/26/2025 |
%Y |
Year with century | 2025 |
%y |
Year without century (00-99) | 25 |
%Z |
Timezone name | MDT |
%z |
Timezone offset | -0600 |
%+ |
National representation of date and time | Sat Jul 26 16:19:03 MDT 2025 |
%-* %_* %0*
|
GNU libc extension | |
%% |
Percent | % |