Date: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 17: | Line 17: | ||
</pre> | </pre> | ||
iso format | |||
<pre> | <pre> | ||
date '+%F' # 2019-04-11 | date '+%F' # 2019-04-11 | ||
# shorthand for # | |||
date '+%Y-%m-%d' | |||
</pre> | </pre> | ||
Latest revision as of 21:18, 11 April 2019
Displaying the date
To return the current date to look like 6/23/06:
date '+%m/%d/%y'
Another example:
date '+DATE: %m/%d/%y%nTIME:%H:%M:%S'
would list the time and date as below:
DATE: 02/08/01 TIME:16:44:55
iso format
date '+%F' # 2019-04-11 # shorthand for # date '+%Y-%m-%d'
Setting the date
Example:
date -s "11/20/2003 12:48:00"
On older Unix systems, this command works to set the date:
date MMDDHHMM[[CC]YY], e.g. date 042716252006 (for 4:25pm, 4/27/2006)