Skip to content

Instantly share code, notes, and snippets.

@CarlRevell
Created December 30, 2013 15:37
Show Gist options
  • Save CarlRevell/8183564 to your computer and use it in GitHub Desktop.
Save CarlRevell/8183564 to your computer and use it in GitHub Desktop.
Useful DOS .cmd/.bat file date and time snippets.
SET YEAR=%DATE:~6,4%
SET MONTH=%DATE:~3,2%
SET DAY=%DATE:~0,2%
SET HOUR=%TIME:~0,2%
IF /I %HOUR% LEQ 9 SET HOUR=0%HOUR:~1,1%
SET MINUTE=%TIME:~3,2%
SET SECOND=%TIME:~6,2%
SET ISODATE=%YEAR%-%MONTH%-%DAY%_%HOUR%-%MINUTE%-%SECOND%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment