Monday, December 14, 2009

Convert among date formats with date(1)

http://www.gnu.org/software/coreutils/manual/html_node/date-invocation.html

# Now
$ date 
Mon Dec 14 15:09:51 EST 2009

# Relative dates
$ date -d 'yesterday'
Sun Dec 13 15:09:56 EST 2009

# Seconds since the UNIX epoch
$ date +%s
1260821405

# From seconds to the default format
$ date -d @$(date +%s)
Mon Dec 14 15:10:25 EST 2009
blog comments powered by Disqus