Does batch have a way to deal with remainders?
I am making a calendar in batch that will account for leap years. I want to take the date and divide it by 4. If it has a remainder then it is not a leap year, if it does not then it is a leap year. I cannot find any way to draw out the remainder.
Remainders
Moderator: DosItHelp
-
- Expert
- Posts: 442
- Joined: 01 Aug 2010 17:13
- Location: Canadian Pacific
- Contact:
Re: Remainders
Code: Select all
set /a remainder=%date%%%4,date/=4
if %remainder% NEQ 0 echo:Remainder not equal to 0.
%%4 = %4 = modulus 4
and...
set /a remainder=%date%%%4,date/=4
is the same as:
set /a remainder=%date%%%4
set /a date=%date%/4
-
- Posts: 319
- Joined: 12 May 2006 01:13
Re: Remainders
are you working on MSDOS ? if not, try using vbscript for dates.