How is it possible to compare 2 dates in batch files? This:
if %%newdate geq %olddate% _do smth_
does not work.
In this case I have that27.05.2013
is greater than 15.07.2013
and14.07.2013
is 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With