I am creating two dates in the format yyyyddd. I start by taking the year and multiplying by 1000
You may find these scripts useful
http://www.commandline.co.uk/cmdfuncs/dandt/index.htmlAlso, VBscript has built in date math functions. You can use them from batch, if VBscripts are allowed on your system
@echo off
REM Create VBscript
echo wsh.echo Year(wscript.arguments(0))^&DatePart("y", wscript.arguments(0))>Daynumber.vbs
REM now you can use it in your script as many times as you want
set querydate1=20/11/2009
REM pass the date to the VBscript & get back the result
for /f "delims==" %%D in ('cscript //nologo Daynumber.vbs %querydate1%') do set Daynumber1=%%D
set querydate2=20/03/2009
for /f "delims==" %%D in ('cscript //nologo Daynumber.vbs %querydate2%') do set Daynumber2=%%D
echo The day number of %querydate1% is %Daynumber1%
echo The day number of %querydate2% is %Daynumber2%
output
The day number of 20/11/2009 is 2009324
The day number of 20/03/2009 is 200979As you can see, my system uses the European dd/mm/yyyy format for dates but I believe that if your system locale settings are US you would find that 11/19/2009 would give you 2009323 but you would have to try that yourself.