FUNCTION date2,date1,days ; Returns the date equivalent to date1 + days, where date is ; a date of the form yyyyddd and days is a positive or negative ; number of days. ; B. G. Knapp, 87/02/06 siz = SIZE(date1) IF siz(1) EQ 0 THEN BEGIN PRINT," " PRINT," DATE2 returns a double precision date of the form " PRINT," YYYYDDD.DD resulting from adding the number of days " PRINT," given by its second argument, to the date (also in the " PRINT," form YYYYDDD.DD) given by its first argument. The " PRINT," calling sequence is illustrated below. " PRINT," " PRINT," newdate = date2(olddate,ndays) " RETURN," " ENDIF y = LONG(date1/1000)+9999L d = LONG(y*365.25D0)+y/400-y/100+ABS(date1) MOD 1000L+days c = LONG(d/36524.25D0) d = d+c-LONG(c/4.) y = LONG(d/365.250001D0) d = ABS(y-9999L)*1000+(d-LONG(y*365.25D0)) d_typ = SIZE(d) IF d_typ(0) EQ 0 THEN BEGIN IF y LT 9999 THEN d = -d ENDIF ELSE BEGIN pick = WHERE(y LT 9999) if pick(0) GE 0 then d(pick) = -d ENDELSE RETURN,d END