markus / DateTime.bat @ master
이력 | 보기 | 이력해설 | 다운로드 (440 Bytes)
1 | 9d5b4bc2 | taeseongkim | @ECHO ON |
---|---|---|---|
2 | @REM use FOR /F to 'break out' the components of %DATE% and %TIME%, assuming 'yyyy/mm/dd' format date i.e. |
||
3 | |||
4 | for /F "tokens=1-6* delims=.:-/ " %%i IN ("%DATE% %TIME%") DO Set "YYYY=%%i"& Set "MM=%%j"& Set "DD=%%k"& Set "HH=%%l"& Set "MI=%%m"& Set "SS=%%n" |
||
5 | |||
6 | @REM Switch the year and day if appropriate |
||
7 | |||
8 | IF NOT "X%DD:~2%" == "X" Set "YYYY=%DD%"& Set "DD=%YYYY%" |
||
9 | |||
10 | Set "TimeStamp=%YYYY%%MM%%DD%%HH%%MI%%SS%" |
||
11 | echo %TimeStamp% |