For When You Can't Have The Real Thing
[ start | index | login ]
start > Linux > date in ISO format

date in ISO format

Created by dave. Last edited by dave, 5 years and 15 days ago. Viewed 1,477 times. #3
[diff] [history] [edit] [rdf]
labels
attachments
(2013-04-03)

Echo the date in ISO format:

# date '+%Y-%m-%d'
2013-04-03

(This is one of those stupid things I should remember but never do.)

Bash alias:

alias today='export TODAY=`date +%Y-%m-%d` ; echo $TODAY'

Now you can do stupid tricks like

$ mkdir ~/tmp/`today`
$ cd ~/tmp/$TODAY

Update:

or you can just do

# date -I
which is short enough to use inline:
# mkdir ~/tmp/`date -I`
no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt