Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hey!
i've finally got my batch working, and now i'm just smoothing things out.
is there a way to automatically calculate the the number of days since a certain date??

Hi
This Help@echo off
cls
if (%6)==() goto Syntax
echo Date1=%1/%2/%3
call :CalcDateNo %1 %2 %3
set Date1=%Z%
echo Date1 No=%Z%
call :CalcDateNo: %4 %5 %6
echo Date2=%4/%5/%6
set /a Diff=%Z%-%Date1%
echo Date2 No=%Z%
echo Diff=%Diff%
exit /b
:CalcDateNo %1 %2 %3
set Day=%1
set Month=%2
set Year=%3rem Delele Leading Zeros
set Char=%Day:~0,1%
if %Char%==0 set Day=%Day:~1,1%
set Char=%Month:~0,1%
if %Char%==0 set Month=%Month:~1,1%
if %Month% LEQ 2 (
set /a Year-=1
set /a Month+=12
)
set /a Month+=1
set /a A=%Year%/100
set /a B=2-%A%+%A%/4
set /a C=36525*%Year%/100
set /a D=306001*%Month%/10000
set /a E=%Day%+1720995+%B%
set /a Z=%C%+%D%+%E%
exit /b:Syntax
echo Enter DateCalc Day Month Year Day Month Year
echo ie DateCalc 05 08 2009 05 08 2010
echo Calculate Difference between
echo Date1 and Date2
echo One leading zero is accepted
echo for Day and Month, Year must be
echo be in full. Date not validated.
exit /b

![]() |
Microsoft Dot net Windows...
|
renaming a part of multip...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |