I know how to return current date like below.
set year=%date:~10,4%
set month=%date:~4,2%
set day=%date:~7,2%
echo %month%-%day%-%year%
but now I need to return yesterday's date. is it possible?
dos yesterday's date
Moderator: DosItHelp
-
- Posts: 319
- Joined: 12 May 2006 01:13
yes its possible to do with batch BUT at the expense of losing your brain cells.
try using vbscript
try using vbscript
Code: Select all
DateAdd("d",-1,Now)
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
Probably the "easiest" way is dos is to convert to a julian date, subtract 1, and convert back to "normal" date using the various subroutines from this website:
http://www.dostips.com/DtTipsDateTime.php
http://www.dostips.com/DtTipsDateTime.php