Posted by Robert G Laurin on January 10, 2006 at 13:19:42:
In Reply to: Subroutine to find the Julian Date posted by Greg on January 10, 2006 at 11:46:54:
I have a routine that takes recognisable date and convert it to known format types - including Julian.
Specifically for Julian:
Parse the date as DAY, MONTH and YEAR where Year is relative to 1900.
Figure out leap year as such:
LET LeapYear=2
IF FPT((YEAR+1900)*.2500) = 0 THEN LeapYear = 1 ! Every 4 Years
IF FPT((YEAR+1900)*.0100) = 0 THEN LeapYear = 2 ! Not Every 100
IF FPT((YEAR+1900)*.0025) = 0 THEN LeapYear = 1 ! But Every 400
LET DayOfYear = INT(MONTH * 275 / 9.00) + DAY - 30
IF MONTH > 2 THEN DayOfYear = DayOfYear - LeapYear
LET JULIAN = YEAR * 1000 + DayOfYear
Been using this for 20+ years and it works just fine !
Hope you like it !!!
Robert