coreutils: Options for date
1
1 21.1.6 Options for ‘date’
1 -------------------------
1
11 The program accepts the following options. Also see ⇒Common
options.
1
1 ‘-d DATESTR’
1 ‘--date=DATESTR’
1 Display the date and time specified in DATESTR instead of the
1 current date and time. DATESTR can be in almost any common format.
1 It can contain month names, time zones, ‘am’ and ‘pm’, ‘yesterday’,
1 etc. For example, ‘--date="2004-02-27 14:19:13.489392193 +0530"’
1 specifies the instant of time that is 489,392,193 nanoseconds after
1 February 27, 2004 at 2:19:13 PM in a time zone that is 5 hours and
1 30 minutes east of UTC.
1 Note: input currently must be in locale independent format. E.g.,
1 the LC_TIME=C below is needed to print back the correct date in
1 many locales:
1 date -d "$(LC_TIME=C date)"
1 ⇒Date input formats.
1
1 ‘--debug’
1 Annotate the parsed date, display the effective time zone, and warn
1 about potential misuse.
1
1 ‘-f DATEFILE’
1 ‘--file=DATEFILE’
1 Parse each line in DATEFILE as with ‘-d’ and display the resulting
1 date and time. If DATEFILE is ‘-’, use standard input. This is
1 useful when you have many dates to process, because the system
1 overhead of starting up the ‘date’ executable many times can be
1 considerable.
1
1 ‘-I[TIMESPEC]’
1 ‘--iso-8601[=TIMESPEC]’
1 Display the date using an ISO 8601 format, ‘%Y-%m-%d’.
1
1 The argument TIMESPEC specifies the number of additional terms of
1 the time to include. It can be one of the following:
1 ‘auto’
1 Print just the date. This is the default if TIMESPEC is
1 omitted.
1
1 ‘hours’
1 Append the hour of the day to the date.
1
1 ‘minutes’
1 Append the hours and minutes.
1
1 ‘seconds’
1 Append the hours, minutes and seconds.
1
1 ‘ns’
1 Append the hours, minutes, seconds and nanoseconds.
1
1 If showing any time terms, then include the time zone using the
1 format ‘%:z’. This format is always suitable as input for the
1 ‘--date’ (‘-d’) and ‘--file’ (‘-f’) options, regardless of the
1 current locale.
1
1 ‘-r FILE’
1 ‘--reference=FILE’
1 Display the date and time of the last modification of FILE, instead
1 of the current date and time.
1
1 ‘-R’
1 ‘--rfc-email’
1 Display the date and time using the format ‘%a, %d %b %Y %H:%M:%S
1 %z’, evaluated in the C locale so abbreviations are always in
1 English. For example:
1
1 Fri, 09 Sep 2005 13:51:39 -0700
1
1 This format conforms to Internet RFCs 5322
1 (https://tools.ietf.org/search/rfc5322), 822
1 (https://tools.ietf.org/search/rfc2822) and 822
1 (https://tools.ietf.org/search/rfc822), the current and previous
1 standards for Internet email. For compatibility with older
1 versions of ‘date’, ‘--rfc-2822’ and ‘--rfc-822’ are aliases for
1 ‘--rfc-email’.
1
1 ‘--rfc-3339=TIMESPEC’
1 Display the date using a format specified by Internet RFC 3339
1 (https://tools.ietf.org/search/rfc3339). This is like
1 ‘--iso-8601’, except that a space rather than a ‘T’ separates dates
1 from times. This format is always suitable as input for the
1 ‘--date’ (‘-d’) and ‘--file’ (‘-f’) options, regardless of the
1 current locale.
1
1 The argument TIMESPEC specifies how much of the time to include.
1 It can be one of the following:
1
1 ‘date’
1 Print just the full-date, e.g., ‘2005-09-14’. This is
1 equivalent to the format ‘%Y-%m-%d’.
1
1 ‘seconds’
1 Print the full-date and full-time separated by a space, e.g.,
1 ‘2005-09-14 00:56:06+05:30’. The output ends with a numeric
1 time-offset; here the ‘+05:30’ means that local time is five
1 hours and thirty minutes east of UTC. This is equivalent to
1 the format ‘%Y-%m-%d %H:%M:%S%:z’.
1
1 ‘ns’
1 Like ‘seconds’, but also print nanoseconds, e.g., ‘2005-09-14
1 00:56:06.998458565+05:30’. This is equivalent to the format
1 ‘%Y-%m-%d %H:%M:%S.%N%:z’.
1
1 ‘-s DATESTR’
1 ‘--set=DATESTR’
11 Set the date and time to DATESTR. See ‘-d’ above. See also ⇒
Setting the time.
1
1 ‘-u’
1 ‘--utc’
1 ‘--universal’
1 Use Universal Time by operating as if the ‘TZ’ environment variable
1 were set to the string ‘UTC0’. UTC stands for Coordinated
1 Universal Time, established in 1960. Universal Time is often
1 called “Greenwich Mean Time” (GMT) for historical reasons.
1 Typically, systems ignore leap seconds and thus implement an
1 approximation to UTC rather than true UTC.
1