UNIX Quick Tip: See the current UNIX Timestamp and other date formats on the command line
The UNIX date command can show the current (or a future) date in several different formats. The command’s default output presents a full date string:
date Sat Mar 7 07:25:51 SAST 2009
… but this output can be modified by specifying certain arguments.
To see the output in a different format:
date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" DATE: 2009-03-07 TIME: 07:27:43
To see the last Friday of the month:
date -v1d -v+1m -v-1d -v-fri Fri Mar 27 07:29:28 SAST 2009
To display the current UNIX Timestamp:
date +%s 1236403850
The date command has several other arguments which can be found by reviewing its man page:
man date
Related posts:



07 Mar 2009 








author
No comments yet... Be the first to leave a reply!