What is your favorite date and time format in a file name? [closed]
I use this:
My-File--2009-12-31--23-59-59.txt
- No spaces
- Double dashes to separate the pieces, making each piece easy to see
- Only one punctuation character (dash) making it easy to type
- No timezone because for me I'm always working in my local timezone; if I needed one I'd go with UTC and append "
--UTC
" after the time.
I'd use YYYY-MM-DD HHmmss
for filenames, unless there is a particular need for timezones or a possible need to parse them into ISO dates; in those cases an ISO date would probably be preferrable.
Edit: Timezones shouldn't really ever be required; saving everything in UTC and letting people know that it's all UTC is more efficient than specifying the time zone of everything.