Linux and Unix date command

Quick links

About date
Syntax
Examples
Additional Information
Related commands

Linux and Unix main page

About date

Tells you the date and time in Unix.

Syntax

date [-a] [-u] [-s datestr]

-a Slowly adjust the time by sss.fff seconds (fff represents fractions of a second). This adjustment can be positive or negative. The system's clock will be sped up or slowed down until it has drifted by the number of seconds specified. Only the super-user may adjust the time.
-u Display (or set) the date in Greenwich Mean Time (GMT-universal time), bypassing the normal conversion to (or from) local time.
-s datestr Sets the time and date to the value specfied in the datestr. The datestr may contain the month names, timezones, 'am', 'pm', etc. See examples for an example of how the date and time can be set.

Examples

date

List the date and time of the server. Below is an example of the output.

Thu Feb 8 16:47:32 MST 2001

date -s "11/20/2003 12:48:00"

Set the date to the date and time shown.

date '+DATE: %m/%d/%y%nTIME:%H:%M:%S'

Would list the time and date in the below format.

DATE: 02/08/01
TIME:16:44:55

Additional information

If you are looking for additional information about the release date of Unix or a Unix variant see the Linux and Unix history page.

Related commands

time