Re: DAY Number in an Year



ttw@xxxxxxxxxxxxxxx wrote:
In 2003, I suggested:
FUNCTION juldate (year,month,day)
c
c   Converts DAY/MONTH/YEAR to a Julian date transformed to 2000
c
       IMPLICIT NONE
c
      INTEGER juldate, day, month, year
c

juldate=367*year-7*(year+(month+9)/12)/4-3*((year+(month-9)/7)/100


1 +1)/4+275*month/9+day-730516 END


The constant 730516 can be adjusted to match any date desired as the starting point or to change Gregorian dates to Julian.


Note, however, that Julian days formally begin at 12 noon. So your algorithm has an off-by-one error for AM vs PM.


cheers,

Rich

PS I'm talking about the astronomical Julian calendar, as created by Julius Scalinger. For some reason, many programmers refer to the days-since-arbitrary epoch (say, 1900 or 1970) as the Julian date, but that's just wrong.
.




Relevant Pages

  • Re: DAY Number in an Year
    ... FUNCTION juldate ... IMPLICIT NONE ... INTEGER juldate, day, month, year ... starting point or to change Gregorian dates to Julian. ...
    (comp.lang.fortran)
  • Re: DAY Number in an Year
    ... FUNCTION juldate c ... IMPLICIT NONE ... INTEGER juldate, day, month, year c ... starting point or to change Gregorian dates to Julian. ...
    (comp.lang.fortran)
  • Re: DAY Number in an Year
    ... >> FUNCTION juldate ... >> the starting point or to change Gregorian dates to Julian. ... For a one-to-one correspondence with calendar dates, ... the leap day at the end of Feb. was at the end ...
    (comp.lang.fortran)
  • Re: DAY Number in an Year
    ... ttw@xxxxxxxxxxxxxxx schrieb: ... > FUNCTION juldate ... > starting point or to change Gregorian dates to Julian. ... Prev by Date: ...
    (comp.lang.fortran)
  • Re: C vs Perl
    ... What about Julian Albo's (sorry Julian, don't know how to put the accent on in Moz...)? ... His is three lines shorter: ... uses the implicit return 0 from main ...
    (comp.lang.cpp)