Tells you the date (and the time) and is also used to set the date/time.
To set the date, type date MM:DD:YYYY (American style date) where MM is month, DD is the number of days within the month and YYYY is the year.
For example to set the date to the 1st January 2000 you would type:
To set the time (where the -s option is to set a new time), type:
Another useful option you can use is --date="string" (or -d "string") option to display a date from x days ago or in x days (or x weeks, months, years et cetera). See
the examples below.
Examples:
date --date="3 months 1 day ago"
|
Will print the date 3 months and 1 day ago from the current date. Note that --date="x month x day ago" and -d "x month x day ago" are equivalent.
The above command will print the date 3 days forward in time from now.