Fun with date

From ConShell
Jump to navigation Jump to search

The date(1) command is capable of many things.

Convert an epoch (unix time) into something a human can make sense of

date --date='@2147483647'

Print yesterday's date. Handy for monthly cronjobs scheduled on day 1 but need to get the date of the last day prior month

date --date='1 day ago'
Wed Sep  2 11:01:35 PDT 2015