How can i edit this code to make it time-stamp a folder in this format: YYYY-MM-DD_HH.MM.SS
Ex. 2007-05-08_05.30.12
just a few modifications... 12,4 is key here for the YYYY
Posted by
Anne Gentle
at
2007-05-08 14:17
The way to get a four-digit year is to change the second value when extracting the year variable. After getting the four-digit year value, you can just insert dashes and periods. So this should work:
set hh=%time:~0,2%
if "%time:~0,1%"==" " set hh=0%hh:~1,1%
set yyyy-mm-dd_hh.mm.ss=%date:~12,4%-%date:~4,2%-%date:~7,2%_%hh%.%time:~3,2%.%time:~6,2%
md c:\temp\%yyyy-mm-dd_hh.mm.ss%
Thanks everyone for the appreciation for this code! In turn I appreciate our expert Search Engine Optimizer, Tom Parish, for making this page a high hit in Google searches for dos date searches. :)
Ex. 2007-05-08_05.30.12
set hh=%time:~0,2%
if "%time:~0,1%"==" " set hh=0%hh:~1,1%
set yyyy-mm-dd_hh.mm.ss=%date:~12,4%-%date:~4,2%-%date:~7,2%_%hh%.%time:~3,2%.%time:~6,2%
md c:\temp\%yyyy-mm-dd_hh.mm.ss%
Thanks everyone for the appreciation for this code! In turn I appreciate our expert Search Engine Optimizer, Tom Parish, for making this page a high hit in Google searches for dos date searches. :)
Replies to this comment
set FileName=%date:~10,4%%date:~4,2%%date:~7,2%
that is 10,4 not 12,4