I posted a description below on some site a while ago:
The following batch files are converted from Date to Julian Day Number and vice versa:
DATETOJULIAN.BAT:
@ECHO OFF REM CONVERT DATE TO JULIAN DAY NUMBER REM ANTONIO PEREZ AYALA REM GET MONTH, DAY, YEAR VALUES FOR /F "TOKENS=1-3 DELIMS=/" %%A IN ("%1") DO SET MM=%%A& SET DD=%%B& SET YY=%%C REM ELIMINATE LEFT ZEROS SET /A DD=10%DD% %% 100, MM=10%MM% %% 100 REM CALCULATE JULIAN DAY NUMBER IF %MM% LSS 3 SET /A MM+=12, YY-=1 SET /AA=YY/100, B=A/4, C=2-A+B, E=36525*(YY+4716)/100, F=306*(MM+1)/10, JDN=C+DD+E+F-1524
JULIANTODATE.BAT:
REM CONVERT JULIAN DAY NUMBER TO MONTH, DAY, YEAR REM ANTONIO PEREZ AYALA SET /AW=(%1*100-186721625)/3652425, X=W/4, A=%1+1+WX, B=A+1524, C=(B*100-12210)/36525, D=36525*C/100, E=(BD)*10000/306001, F=306001*E/10000, DD=BDF, MM=E-1, YY=C-4716 IF %MM% GTR 12 SET /A MM-=12, YY+=1 REM INSERT LEFT ZEROS, IF NEEDED IF %DD% LSS 10 SET DD=0%DD% IF %MM% LSS 10 SET MM=0%MM% REM SHOW THE DATE ECHO %MM%/%DD%/%YY%
Thus, to add / subtract the number of days before the date, use the following lines:
CALL DATETOJULIAN %DATE% SET /A NEWDATE=JDN+DAYS CALL JULIANTODATE %NEWDATE%
Respectfully...
Link: http://quasar.as.utexas.edu/BillInfo/JulianDatesG.html
You just need to adjust the date format if it is not MM / DD / YYYY.