1.

Solve : how decrement my var %day%?

Answer»

hello

i would like to know how can i decrement my VAR %day%
actually i have the day of today in this var and i would like the day before

set day =%DATE:~13,2% ----->today
set filename =%date:~5,4%%date:~10,2%%day%

what should i do to decrement %day% from one day

thanks in advanceTry this:

set /a day =%date:~13,2%-1

Are you SURE 13,2 is correct? Potential problem EXISTS on the first day of the month. Batch language does not do date arithmetic.

Hope this helps. o thanks but as u said there is still a problem with the first day of the month because there is no 0 of may or june

how do u SOLVE this type of problem usually???Personally I would use VB Script. It has great date handling functions and is a better solution on Windows machines. You can get more info on VB Script from:

http://msdn.microsoft.com/library/default.asp?url=/downloads/list/webdev.asp

Good luck.



Discussion

No Comment Found