c$Header: /weru/cvs/weps/weps.src/util/date/julday.for,v 1.1.1.1 1999-03-12 17:05:31 wagner Exp $ c c JULDAY is taken from _Numerical_Recipes:_The_Art_of_Scientific_Computing_ c integer function julday i (dd, mm, yyyy) c c + + + PURPOSE + + + c In this routine JULDAY returns the Julian Day Number which begins at c noon of the calendar date specified by day "dd", month "mm", & year "yyyy" c All are integer variables. Positive year signifies A.D.; negative, B.C. c Remember that the year after 1 B.C. was 1 A.D. c The following invalid calendar dates are checked for and reported: c 1. zero year c 2. dates between 4/10/1582 and 15/10/1582 are specified. c c Additional checking for other invalid dates could be added c in the future if necessary. c c + + + KEYWORDS + + + c date, utility c c + + + ARGUMENT DECLARATIONS + + + integer dd, mm, yyyy integer igreg c c c + + + ARGUMENT DEFINITIONS + + + c dd - integer value of day in the range 1-31 c mm - month in the range 1-12 c yyyy - year (negative A.D., positive B.C.) c c + + + PARAMETERS + + + c Gregorian Calendar was adopted on Oct. 15, 1582. parameter (igreg=15+31*(10+12*1582)) c c + + + LOCAL VARIABLES + + + integer jy, jm, ja c c + + + END SPECIFICATIONS + + + c if (yyyy.eq.0) pause 'There is no year zero' if ((yyyy.eq.1582) .and. (mm.eq.10) .and. c (dd.lt.15) .and. (dd.gt.4)) pause 'This is an invalid date' if (yyyy.lt.0) yyyy=yyyy+1 if (mm.gt.2) then jy=yyyy jm=mm+1 else jy=yyyy-1 jm=mm+13 endif julday=int(365.25*jy)+int(30.6001*jm)+dd+1720995 if (dd+31*(mm+12*yyyy).ge.igreg) then ja=jy/100 c ja=int(dble(0.01)*dble(jy)) julday=julday+2-ja+int(dble(0.25)*dble(ja)) endif return end c c$Log: not supported by cvs2svn $ c Revision 1.2 1998/09/03 18:35:36 jt c check in a full copy of WEPS - I hope ??? c c Revision 1.1.1.1 1995/01/18 04:20:07 wagner c Initial checkin c c Revision 2.2 1992/04/03 23:04:07 wagner c changed from multiplying by 0.01 to dividing by 100 c to alleviate floating point roundoff problem that c exists with Microsoft FORTRAN v5.1 compiler when c the dates of 28/2/1900 - 28/2/1901 are input. c Hopefully, this will fix that problem without c others surfacing from this change. c The line used to be: c ja=int(dble(0.01)*dble(jy)) c It is now: c ja=jy/100 c c Revision 2.1 1992/03/27 17:22:53 wagner c Fixed roundoff problems by adding some c double precision casts (DBLE) to some c constants and integer variables in a c couple of intermediate computations. c c Also added some preliminary error checking c for a zero year and the "missing" days c between 4/10/1582 and 15/10/1582. c c Version 2 code. c