Following are various ways to display a past date and time:
$ date --date='3 seconds ago' Thu Jan 1 08:27:00 PST 2009 $ date --date="1 day ago" Wed Dec 31 08:27:13 PST 2008 $ date --date="1 days ago" Wed Dec 31 08:27:18 PST 2008 $ date --date="1 month ago" Mon Dec 1 08:27:23 PST 2008 $ date --date="1 year ago" Tue Jan 1 08:27:28 PST 2008 $ date --date="yesterday" Wed Dec 31 08:27:34 PST 2008 $ date --date="10 months 2 day ago" Thu Feb 28 08:27:41 PST 2008
Comments on this entry are closed.
Some times is very useful to know the date of specific weekday, for example:
date -d “last friday” //date of last Friday from today
date -d “next friday” //date of next Friday from today