| DATE(1) | General Commands Manual | DATE(1) |
date — display
date and time
date |
[-jRu] [-I
iso_fmt] [-d
datetime | -r
epoch]
[+format] |
date |
[-jRu] [-I
iso_fmt]
mmddHHMM[[CC]yy]
[+format] |
date |
[-jRu] [-I
iso_fmt] -f
now_format now
[+format] |
When date is invoked without arguments it
displays the current time Otherwise, depending on the options specified,
will print the datetime in a user-defined way.
-d
datetime-f
now_format-I
iso_fmt-j-f flag to convert one datetime to another.-u-r
epoch-R-j isn't set, the system
time is also set.
Each letters corresponds to:
For example 072505542024 corresponds to 2024-07-25T05:54, as you can verify with the following command:
date -j 072505542024
+%Y-%m-%dT%H:%M+format%c’Multiple different but unambiguous formats are supported: @epoch, Email, asctime, RFC3339.
Leading @ (at) symbol followed by the Unix timestamp (number of
seconds before and after 1970-01-01 00:00:00Z), for example
‘@1698791420’ corresponds to
2023-10-31 23:30:20 UTC
Also known as "Internet Message Format" (RFC5322, RFC2822, RFC822), for example:
Fri, 21 Nov 1997 09:55:06
-0600’21 Nov 97 09:55:06 GMT’Output format of asctime(3), for
example: ‘Sun Sep 16 01:03:52
1973’
Profile of ISO 8601:1988, found in modern protocols and
file formats. Formatted as
‘YYYY-MM-DDThh:mm:SS[frac][tz]’,
where:
YYYY-MM-DD’T’T’ or a space.[frac]’[tz]’[+-]HH:?MM’ or the
letter "Z", signifying UTC.Some examples:
2003-06-02T13:37:42.713Z’1971-01-02T03:04:05.678+0900’Look at the manual page of strftime(3)
for the environment variables, typical ones are TZ,
LC_TIME and LC_ALL but this
depends on your system.
The date utility exits 0 on
success, and >0 if an error occurs.
date should be compliant with the IEEE Std
1003.1-2024 (“POSIX.1”) specification.
The -d and -R
options are present for compatibility with other modern systems such as
NetBSD, BusyBox, and GNU coreutils.
The -r option is inspired from BSD and illumos,
-f and -j options are
inspired by FreeBSD and NetBSD.
The %N and %:z formats are extensions inspired from GNU coreutils.
The -I option was added for compatibility
with GNU coreutils, BusyBox, FreeBSD 12.0+.
The -R, -d,
-f, -j, and
-r options were present in utils-std 0.0.1. The
-I option and %N and %:z formats were added in
utils-std 0.0.2.
Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
| April 6, 2025 | Linux |