Yesterday

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
drgt
Posts: 160
Joined: 21 Sep 2010 02:22
Location: Greece

Yesterday

#1 Post by drgt » 23 Oct 2021 23:13

I use this for "Today" timestamp:

Code: Select all

for /f %%i in ('WMIC OS Get LocalDateTime /value') do for /f %%j in ("%%i") do set "%%j"
set today=%LocalDateTime:~0,8%
Can I get "Yesterday" from this OR do I have to run the code mentioned in viewtopic.php?f=3&t=9254&p=60208&hilit= ... amp#p60208

Thanks

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Yesterday

#2 Post by aGerman » 24 Oct 2021 04:12

Yes the :DaysAdd routine is able to calculate this for you. I'm not aware of any command that provides you yesterday's date out of the box. So we have no better possibility than adapting the formulas for Julian Day Numbers of the Gregorian Calendar.

Steffen

Aacini
Expert
Posts: 1914
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: Yesterday

#3 Post by Aacini » 24 Oct 2021 22:10


Post Reply