...okay, since the asker wants me to do all the work for him, here's the script:
@echo off & setlocal
set now=%date%
set then=2010-08-01
:: split into year, month, day
set nY=%now:~0,4%&set nM=%now:~5,2%&set nD=%now:~8,2%
set tY=%then:~0,4%&set tM=%then:~5,2%&set tD=%then:~8,2%
:: remove leading zero
if "%nM:~,1%"=="0" set nM=%nM:~1%
if "%tM:~,1%"=="0" set tM=%tM:~1%
if "%nD:~,1%"=="0" set nD=%nD:~1%
if "%tD:~,1%"=="0" set tD=%tD:~1%
set mdays=31 28 31 30 31 30 31 31 30 31 30 31
set n=0
set t=0
call :days n %nM% %mdays%
call :days t %tM% %mdays%
set /a d=(t+tD)-(n+nD) + ((tY-nY) * 365)
goto :skip
:days
set var=%1
set M=%2
set i=0
shift & shift
:days_loop
if %i% geq %M% goto :EOF
set /a i=i+1
set /a %var%=%var%+%1
shift & goto :days_loop
:skip
echo The difference between %now% and %then% is %d% days.
For comparison, the same thing in Python:
import datetime
now = datetime.datetime.now()
then = datetime.datetime(
# Do NOT use leading zeros here.
year = 2010,
month = 8,
day = 1,
)
diff = then - now