Return to Snippet

Revision: 36934
at December 1, 2010 00:07 by cappellin


Initial Code
for /F "tokens=1* delims= " %%A in ('date /T') do set CDATE=%%B
for /F "tokens=1,2 eol=/ delims=/ " %%A in ('date /T') do set mm=%%B
for /F "tokens=1,2 delims=/ eol=/" %%A in ('echo %CDATE%') do set dd=%%B
for /F "tokens=2,3 delims=/ " %%A in ('echo %CDATE%') do set yyyy=%%B
set date=%yyyy%%mm%%dd%

Initial URL

                                

Initial Description
The code works if and only if your system is using English(United States) date format (i.e. "Web 05/11/2011"). 
If your systems is using English(United Kingdom) date format just replace %%B in the first and third rows with %%A.

Initial Title
Get current date in format YYYYMMDD

Initial Tags
date, format

Initial Language
DOS Batch