Name

date

Synopsis

date [options] [+ format] [date]

Description

Print the current date and time. You may specify a display format. format can consist of literal text strings (blanks must be quoted) as well as field descriptors, whose values will appear as described in the following entries (the listing shows some logical groupings). A privileged user can change the system’s date and time.

Options

+ format

Display current date in a nonstandard format. For example:

                              % date +"%A %j %n%k %p"
Tuesday 248 
15 PM

The default is %a %b %e %T %Z %Y—e.g., Tue Sep 5 14:59:37 EDT 2000.

-d date, --date date

Display date, which should be in quotes and may be in the format d days or m months d days to print a date in the future. Specify ago to print a date in the past. You may include formatting (see the “Format” section that follows).

-f datefile, --file= datefile

Like -d but printed once for each line of datefile.

-I [timespec], --iso-8601[= timespec]

Display in ISO-8601 format. If specified, timespec can have one of the values date (for date only), hours, minutes, or seconds to get the indicated precision.

-r file, --reference= file

Display the time file was last modified.

-R, --rfc-822

Display the date in RFC 822 format.

--help

Print help message and exit.

--version

Print version information and exit.

-s date, --set date

Set the date.

-u, --universal

Set the date to Greenwich Mean Time, not local time.

Format

%

Literal %.

-

Do not pad fields (default: pad fields with zeros).

_

Pad fields with space ...

Get Linux in a Nutshell, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.