Difference between revisions of "Date"

From Linuxintro
imported>ThorstenStaerk
(New page: date is a command to show or set the current system date and time. Examples: * show the date date Fri Apr 17 13:21:55 EDT 2009 * set the date; in this example to april-20, 2009 ...)
 
imported>ThorstenStaerk
 
(8 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
  date
 
  date
 
  Fri Apr 17 13:21:55 EDT 2009
 
  Fri Apr 17 13:21:55 EDT 2009
 +
 +
* in a format sensible for sorting:
 +
date --rfc-3339=date
 +
2014-08-05
 +
date --rfc-3339=seconds
 +
2014-08-05 10:06:54+02:00
 +
date +%Y-%m-%d_%H-%M-%S
 +
2016-01-19_18-30-26
 +
 
* set the date; in this example to april-20, 2009
 
* set the date; in this example to april-20, 2009
 
  sudo date -s 20090420
 
  sudo date -s 20090420
 +
 +
* set the date and time
 +
sudo date -s "2012-10-19 10:20:59"
 +
 +
= See also =
 +
* [http://unixhelp.ed.ac.uk/CGI/man-cgi?date date's man page]
 +
* [[NTP]]
 +
* [[take a screenShot]]
 +
 +
[[Category:Command]]

Latest revision as of 17:31, 19 January 2016

date is a command to show or set the current system date and time.

Examples:

  • show the date
date
Fri Apr 17 13:21:55 EDT 2009
  • in a format sensible for sorting:
date --rfc-3339=date
2014-08-05
date --rfc-3339=seconds
2014-08-05 10:06:54+02:00
date +%Y-%m-%d_%H-%M-%S
2016-01-19_18-30-26
  • set the date; in this example to april-20, 2009
sudo date -s 20090420
  • set the date and time
sudo date -s "2012-10-19 10:20:59"

See also