Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: how decrement my var %day%  (Read 3075 times)

0 Members and 1 Guest are viewing this topic.

af_airone

  • Guest
how decrement my var %day%
« on: April 27, 2005, 06:22:43 AM »
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 advance

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: how decrement my var %day%
« Reply #1 on: April 27, 2005, 07:36:11 AM »
Try 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.    8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

af_airone

  • Guest
Re: how decrement my var %day%
« Reply #2 on: April 27, 2005, 08:35:55 AM »
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???

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: how decrement my var %day%
« Reply #3 on: April 27, 2005, 09:24:45 AM »
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.  8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein