Date (command)

From wikieduonline
Revision as of 12:13, 24 December 2019 by Welcome (talk | contribs) (Created page with "<code>date</code> command allows to print or set the system date and time. == Basic Examples == <pre> $ date -d now Wed Aug 18 16:47:31 EDT 2019 $ date -d today Wed Aug 18...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

date command allows to print or set the system date and time.


Basic Examples

$ date -d now
Wed Aug 18 16:47:31 EDT 2019

$ date -d today
Wed Aug 18 16:47:32 EDT 2019

$ date -d yesterday
Tue Aug 17 16:47:33 EDT 2019

$ date -d tomorrow
Thu Aug 19 16:46:34 EDT 2019

$ date -d sunday
Sun Aug 22 00:00:00 EDT 2019

$ date -d last-sunday
Sun Aug 15 00:00:00 EDT 2019
Other valid date time strings include: last-week, next-week, last-month, next-month, last-year, and next-year.

$ date +%b
Aug 

$ date +%B
August


MacOS:
$ date +%F_-%T
2019-08-03_-09:14:54

Activities

  1. Read date man page: http://man7.org/linux/man-pages/man1/date.1.html

Advertising: