Compare 2 dates in a Windows batch file -


how possible compare 2 dates in batch files? this:

if %%newdate geq %olddate%  _do smth_ 

does not work.

in case have that
27.05.2013 greater than 15.07.2013 and
14.07.2013 less than 15.07.2013

zhenya

try this:

set "sdate1=%olddate:~-4%%olddate:~3,2%%olddate:~0,2%" set "sdate2=%newdate:~-4%%newdate:~3,2%%newdate:~0,2%" if %sdate1% gtr %sdate2% (goto there)  else echo here 

Comments