O'Reilly logo

Linux in a Nutshell, Fourth Edition by Aaron Weber, Stephen Figgins, Ellen Siever

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

date

Synopsis

                  date [options] [+
                  format] [date]

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 following section).

-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

The exact result of many of these codes is locale-specific and depend upon your language setting, particularly the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required