« Awesome Bookmarks Sync with Google Browser Sync | Main | Unix Bash shell: matching files with one or more digits, but NOT other characters »

January 31, 2008

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83420e7e053ef00e5501c1f938834

Listed below are links to weblogs that reference Unix Bash shell: formatting the current date into a timestamp:

Comments

Stephen

Yes, but use capital Y to get a 4 digit year.

mystring=`date "+%Y%m%d-%H%M%S"`

Y2K was only a few years ago. My files with automatic filenames from the 80's still sort in 'ls' properly with new files.

date "+%Y_%m_%d-%H:%M:%S"
is more human readable, and still does proper date/time sorting with 'ls'.

I have over a million files in my home directory (tree) on my home system. Some date to the 1970s. So, yes, they predate my use of Linux. My point is that you've no idea how long files will last. And you can even want old files retroactively (crossing the century boundary).

The comments to this entry are closed.