274 lines
6.3 KiB
Groff
274 lines
6.3 KiB
Groff
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.50.1.
|
|
.TH DATE "1" "April 2025" "GNU coreutils 9.7" "User Commands"
|
|
.\" Define monospaced roman font for groff in troff mode.
|
|
.if t .if \n(.g \{\
|
|
. ds mono \f(CR
|
|
. ds /mono \fP
|
|
.\}
|
|
.SH NAME
|
|
date \- print or set the system date and time
|
|
.SH SYNOPSIS
|
|
.B date
|
|
[\fI\,OPTION\/\fR]... [\fI\,+FORMAT\/\fR]
|
|
.br
|
|
.B date
|
|
[\fI\,-u|--utc|--universal\/\fR] [\fI\,MMDDhhmm\/\fR[[\fI\,CC\/\fR]\fI\,YY\/\fR][\fI\,.ss\/\fR]]
|
|
.SH DESCRIPTION
|
|
.\" Add any additional description here
|
|
.PP
|
|
Display date and time in the given FORMAT.
|
|
With \fB\-s\fR, or with [MMDDhhmm[[CC]YY][.ss]], set the date and time.
|
|
.PP
|
|
Mandatory arguments to long options are mandatory for short options too.
|
|
.TP
|
|
\fB\-d\fR, \fB\-\-date\fR=\fI\,STRING\/\fR
|
|
display time described by STRING, not 'now'
|
|
.TP
|
|
\fB\-\-debug\fR
|
|
annotate the parsed date,
|
|
and warn about questionable usage to stderr
|
|
.TP
|
|
\fB\-f\fR, \fB\-\-file\fR=\fI\,DATEFILE\/\fR
|
|
like \fB\-\-date\fR; once for each line of DATEFILE
|
|
.TP
|
|
\fB\-I[FMT]\fR, \fB\-\-iso\-8601\fR[=\fI\,FMT\/\fR]
|
|
output date/time in ISO 8601 format.
|
|
FMT='date' for date only (the default),
|
|
\&'hours', 'minutes', 'seconds', or 'ns'
|
|
for date and time to the indicated precision.
|
|
Example: 2006\-08\-14T02:34:56\-06:00
|
|
.TP
|
|
\fB\-\-resolution\fR
|
|
output the available resolution of timestamps
|
|
Example: 0.000000001
|
|
.TP
|
|
\fB\-R\fR, \fB\-\-rfc\-email\fR
|
|
output date and time in RFC 5322 format.
|
|
Example: Mon, 14 Aug 2006 02:34:56 \fB\-0600\fR
|
|
.TP
|
|
\fB\-\-rfc\-3339\fR=\fI\,FMT\/\fR
|
|
output date/time in RFC 3339 format.
|
|
FMT='date', 'seconds', or 'ns'
|
|
for date and time to the indicated precision.
|
|
Example: 2006\-08\-14 02:34:56\-06:00
|
|
.TP
|
|
\fB\-r\fR, \fB\-\-reference\fR=\fI\,FILE\/\fR
|
|
display the last modification time of FILE
|
|
.TP
|
|
\fB\-s\fR, \fB\-\-set\fR=\fI\,STRING\/\fR
|
|
set time described by STRING
|
|
.TP
|
|
\fB\-u\fR, \fB\-\-utc\fR, \fB\-\-universal\fR
|
|
print or set Coordinated Universal Time (UTC)
|
|
.TP
|
|
\fB\-\-help\fR
|
|
display this help and exit
|
|
.TP
|
|
\fB\-\-version\fR
|
|
output version information and exit
|
|
.PP
|
|
All options that specify the date to display are mutually exclusive.
|
|
I.e.: \fB\-\-date\fR, \fB\-\-file\fR, \fB\-\-reference\fR, \fB\-\-resolution\fR.
|
|
.PP
|
|
FORMAT controls the output. Interpreted sequences are:
|
|
.TP
|
|
%%
|
|
a literal %
|
|
.TP
|
|
%a
|
|
locale's abbreviated weekday name (e.g., Sun)
|
|
.TP
|
|
%A
|
|
locale's full weekday name (e.g., Sunday)
|
|
.TP
|
|
%b
|
|
locale's abbreviated month name (e.g., Jan)
|
|
.TP
|
|
%B
|
|
locale's full month name (e.g., January)
|
|
.TP
|
|
%c
|
|
locale's date and time (e.g., Thu Mar 3 23:05:25 2005)
|
|
.TP
|
|
%C
|
|
century; like %Y, except omit last two digits (e.g., 20)
|
|
.TP
|
|
%d
|
|
day of month (e.g., 01)
|
|
.TP
|
|
%D
|
|
date (ambiguous); same as %m/%d/%y
|
|
.TP
|
|
%e
|
|
day of month, space padded; same as %_d
|
|
.TP
|
|
%F
|
|
full date; like %+4Y\-%m\-%d
|
|
.TP
|
|
%g
|
|
last two digits of year of ISO week number (ambiguous; 00\-99); see %G
|
|
.TP
|
|
%G
|
|
year of ISO week number; normally useful only with %V
|
|
.TP
|
|
%h
|
|
same as %b
|
|
.TP
|
|
%H
|
|
hour (00..23)
|
|
.TP
|
|
%I
|
|
hour (01..12)
|
|
.TP
|
|
%j
|
|
day of year (001..366)
|
|
.TP
|
|
%k
|
|
hour, space padded ( 0..23); same as %_H
|
|
.TP
|
|
%l
|
|
hour, space padded ( 1..12); same as %_I
|
|
.TP
|
|
%m
|
|
month (01..12)
|
|
.TP
|
|
%M
|
|
minute (00..59)
|
|
.TP
|
|
%n
|
|
a newline
|
|
.TP
|
|
%N
|
|
nanoseconds (000000000..999999999)
|
|
.TP
|
|
%p
|
|
locale's equivalent of either AM or PM; blank if not known
|
|
.TP
|
|
%P
|
|
like %p, but lower case
|
|
.TP
|
|
%q
|
|
quarter of year (1..4)
|
|
.TP
|
|
%r
|
|
locale's 12\-hour clock time (e.g., 11:11:04 PM)
|
|
.TP
|
|
%R
|
|
24\-hour hour and minute; same as %H:%M
|
|
.TP
|
|
%s
|
|
seconds since the Epoch (1970\-01\-01 00:00 UTC)
|
|
.TP
|
|
%S
|
|
second (00..60)
|
|
.TP
|
|
%t
|
|
a tab
|
|
.TP
|
|
%T
|
|
time; same as %H:%M:%S
|
|
.TP
|
|
%u
|
|
day of week (1..7); 1 is Monday
|
|
.TP
|
|
%U
|
|
week number of year, with Sunday as first day of week (00..53)
|
|
.TP
|
|
%V
|
|
ISO week number, with Monday as first day of week (01..53)
|
|
.TP
|
|
%w
|
|
day of week (0..6); 0 is Sunday
|
|
.TP
|
|
%W
|
|
week number of year, with Monday as first day of week (00..53)
|
|
.TP
|
|
%x
|
|
locale's date (can be ambiguous; e.g., 12/31/99)
|
|
.TP
|
|
%X
|
|
locale's time representation (e.g., 23:13:48)
|
|
.TP
|
|
%y
|
|
last two digits of year (ambiguous; 00..99)
|
|
.TP
|
|
%Y
|
|
year
|
|
.TP
|
|
%z
|
|
+hhmm numeric time zone (e.g., \fB\-0400\fR)
|
|
.TP
|
|
%:z
|
|
+hh:mm numeric time zone (e.g., \fB\-04\fR:00)
|
|
.TP
|
|
%::z
|
|
+hh:mm:ss numeric time zone (e.g., \fB\-04\fR:00:00)
|
|
.TP
|
|
%:::z
|
|
numeric time zone with : to necessary precision (e.g., \fB\-04\fR, +05:30)
|
|
.TP
|
|
%Z
|
|
alphabetic time zone abbreviation (e.g., EDT)
|
|
.PP
|
|
By default, date pads numeric fields with zeroes.
|
|
The following optional flags may follow '%':
|
|
.TP
|
|
\-
|
|
(hyphen) do not pad the field
|
|
.TP
|
|
_
|
|
(underscore) pad with spaces
|
|
.TP
|
|
0
|
|
(zero) pad with zeros
|
|
.TP
|
|
+
|
|
pad with zeros, and put '+' before future years with >4 digits
|
|
.TP
|
|
^
|
|
use upper case if possible
|
|
.TP
|
|
#
|
|
use opposite case if possible
|
|
.PP
|
|
After any flags comes an optional field width, as a decimal number;
|
|
then an optional modifier, which is either
|
|
E to use the locale's alternate representations if available, or
|
|
O to use the locale's alternate numeric symbols if available.
|
|
.SH EXAMPLES
|
|
Convert seconds since the Epoch (1970\-01\-01 UTC) to a date
|
|
.IP
|
|
\*[mono]$ date --date='@2147483647'\*[/mono]
|
|
.PP
|
|
Show the time on the west coast of the US (use \fBtzselect\fP(1) to find TZ)
|
|
.IP
|
|
\*[mono]$ TZ='America/Los_Angeles' date\*[/mono]
|
|
.PP
|
|
Show the local time for 9AM next Friday on the west coast of the US
|
|
.IP
|
|
\*[mono]$ date --date='TZ="America/Los_Angeles" 09:00 next Fri'\*[/mono]
|
|
.SH "DATE STRING"
|
|
.\" NOTE: keep this paragraph in sync with the one in touch.x
|
|
The --date=STRING is a mostly free format human readable date string
|
|
such as "Sun, 29 Feb 2004 16:21:42 -0800" or "2004-02-29 16:21:42" or
|
|
even "next Thursday". A date string may contain items indicating
|
|
calendar date, time of day, time zone, day of week, relative time,
|
|
relative date, and numbers. An empty string indicates the beginning
|
|
of the day. The date string format is more complex than is easily
|
|
documented here but is fully described in the info documentation.
|
|
.SH AUTHOR
|
|
Written by David MacKenzie.
|
|
.SH "REPORTING BUGS"
|
|
GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
|
|
.br
|
|
Report any translation bugs to <https://translationproject.org/team/>
|
|
.SH COPYRIGHT
|
|
Copyright \(co 2025 Free Software Foundation, Inc.
|
|
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
|
|
.br
|
|
This is free software: you are free to change and redistribute it.
|
|
There is NO WARRANTY, to the extent permitted by law.
|
|
.SH "SEE ALSO"
|
|
Full documentation <https://www.gnu.org/software/coreutils/date>
|
|
.br
|
|
or available locally via: info \(aq(coreutils) date invocation\(aq
|