home *** CD-ROM | disk | FTP | other *** search
- * Program..: JULIAN.PRG
- * Author...: Merrill Anderson
- * Date.....: January, 1984
- * Notice...: Copyright 1983, 1984 by Merrill Anderson. All rights reserved.
- * dBASE....: II, version 2.4x
- * Notes....: Converts a Gregorian Calendar date to a Julian Period day.
- *
- * Thi≤ algorithφ i≤ onl∙ accuratσ froφ 1/1/000░ t∩ 12/31/399╣ duσ
- * t∩ ß probleφ witΦ negativσ numbers« Thi≤ commanΣ filσ i≤ ß
- * subroutinσ t∩ perforφ thσ calculatioε only« I⌠ expect≤ t∩ bσ
- * passeΣ ß datσ whosσ forma⌠ anΣ conten⌠ havσ alread∙ beeε verifieΣ
- * b∙ thσ callinτ file.
- *
- * Parameters passed:
- * Name typ len picture - description
- * ---------- --- --- --------------------------------------
- * Input to program:
- * mdate C 8 mm/dd/yyyy - Gregorian calendar date.
- *
- * Internal to program (optional output):
- * mm N 2 Month of input date.
- * dd N 2 Day of input date.
- * yr N 4 Four digit year of input date.
- *
- * Output:
- ¬ da∙ ├ │ Da∙ oµ weeδ - threσ character abbr.
- * jd N 7 Julian period day - total days
- * (good from 0 to 3999 AD +\- ?).
- * mon C 3 Month of year - three character abbr.
- * month C 9 Month of year - full spelling.
- * weekday C 9 Day of week - full spelling.
- *
- * If not done in a previous program...
- SET TALK OFF
- *
- * Initialize local memvars...
- STORE VAL($(mdate,1,2)) TO mm
- STORE VAL($(mdate,4,2)) TO dd
- STORE VAL($(mdate,7,4)) TO yr
- STORE 1721060 TO base
- *
- * Calculate Julian Period Day...
- STORE base + yr*365 + INT(yr/4) - INT(yr/100) + INT(yr/400) +;
- VAL($("000031059090120151181212243273304334",mm*3-2,3)) +;
- dd - VAL($('110000000000',mm,1)) *;
- VAL($('10',1+INT(((yr/4)-INT(yr/4))+.75) *;
- INT(((yr/400)-INT(yr/400))+.9975),1)) to jd
- *
- * Calculate name of weekday...
- STORE $( "Monday Tuesday Wednesday" +;
- "Thursday Friday Saturday Sunday " ,;
- (INT(INT((((jd/7.00)-INT(jd/7))*7)+.5))*9+1),9) TO weekday
- STORE $(weekday,1,3) TO day
- *
- * Calculate name of month...
- STORE $( "January Febuary March April May " +;
- "June July August SeptemberOctober November " +;
- "December" ,mm*9-8,9) TO month
- STORE $(month,1,3) TO mon
- *
- * Release local memvars and return to calling program...
- RELEASE mm, dd, yy
- RETURN
- * EOF: Julian.prg