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, 10 years and 94 days ago. Viewed 2,643 times. #3
[diff] [history] [edit] [rdf]

Echo the date in ISO format:

# date '+%Y-%m-%d'

(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


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: | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt