Table of Contents
$ date -I 2005-08-04 $ date -Iseconds 2005-08-04T17:24:39-0400 $ date -Iseconds -u 2007-06-21T13:10:18+0000 $ date '+%H:%M:%S' 17:24:41 $ date '+%Y%m%d' 20020321 $ date '+%y%m%d' 020321
# tomorrow date --date=tomorrow # yesterday date --date='-1 day' # last month date --date='-1 month' # next month date --date='+1 month' '+%m %Y'
$ printf 'Set current time: date '; date '+%m%d%H%M' Set current time: date 03281506 $ printf 'Set current time: date '; date '+%m%d%H%M%y' Set current time: date 0101184403 % date 03181019 Mon Mar 18 10:19:00 CST 2002 $ date Mon Mar 18 10:19:03 CST 2002
Display the current time in the given FORMAT, or set the system date.
%Y year (1970...) %y last two digits of year (00..99) %m month (01..12) %d day of month (01..31) %H hour (00..23) %I hour (01..12) %M minute (00..59) %S second (00..60); the 60 is for a leap second