home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
cpm
/
calculat
/
julian.lbr
/
JULIAN.CQD
/
JULIAN.CMD
Wrap
OS/2 REXX Batch file
|
1987-01-31
|
3KB
|
89 lines
*--------------------------------------------------------------
* The 1984 World Almanac, which tells us that the Julian period
* was devised in 1582 by Joseph Schliger and named after his
* father Julius, not after Julius Caesar or the Julian calendar.
* Scaliger began the first Julian Day (JD) at noon, January 1,
* 4713 B.C., the most recent time that three major chronological
* cycles began on the same day: the 28-year solar cycle, the
* 19-year lunar cycle, and the 15-year indication cycle. It will
* take to the year 3267 to complete the period, a total of 7980
* years which is the product of 28,19, and 15. This algorithm is
* accurate from 1/1/0000 to 12/31/3999 due to a problem with
* negative numbers. MDATE must be previously verified through
* the system date. When using the system date 1900 or greater
* is assumed.
* MDATE = MM/DD/YYYY
* ASSUME 1900 OR GREATER FOR USE OF SYSTEM DATE.
STORE $(DATE(),1,6)+'19'+$(DATE(),7,2) TO MDATE
STORE VAL($(MDATE,1,2)) TO MM
IF MM <= 00 .OR. MM > 12
STORE 'MONTH ERROR' TO TODAY
STORE 'MONTH ERROR' TO BIG:DAY
RELEASE MDATE,MM
RETURN
ENDIF
STORE VAL($(MDATE,4,2)) TO DD
IF DD <= 00 .OR. DD > 31
STORE 'DAY ERROR' TO TODAY
STORE 'DAY ERROR' TO BIG:DAY
RELEASE MDATE,MM,DD
RETURN
ENDIF
STORE VAL($(MDATE,7,4)) TO YR
STORE 1721060 TO BASE
* ----- CALC JULIAN HERE -------------------------------------
STORE BASE + YR*365 + INT(YR/4) - INT(YR/100) + INT(YR/400)+;
VAL($('000031059090120151181212243273301334',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
* ----- CALC NAME OF DAY HERE ---------------------------------
STORE $('Monday Tuesday Wednesday'+;
'Thursday Friday Saturday Sunday ',;
(int(int((((JD/7.00)-INT(JD/7))*7)+.5))*9+1),9) TO TODAY
* ----- CALC NAME OF MONTH HERE -------------------------------
STORE $('January Febuary March April May '+;
'June July August SeptemberOctober November '+;
'December ',MM*9-8,9) to MONTH
* ----- MAKE A GOOD PRINT DATE FROM THE DATA ABOVE ------------
STORE TRIM(TODAY) + ', ' + TRIM(MONTH) + STR(DD,3) + ', ' +;
STR(YR,5) TO BIG:DAY
* ----- RESTORE THE ENVIRONMENT AND EXIT ----------------------
RELEASE MONTH,DD,YR,MM,MDATE,BASE,JD
RETURN
*--------------------------------------------------------------
********** END OF JULIAN.CMD PROGRAM **********
*--------------------------------------------------------------
$('000031059090120151181212243273301334',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
* ----- CALC NAME OF DAY HERE ---------------------------------
STORE $('Monday Tuesday Wednesday'+;
'Thursday Friday Saturday Sunday ',;
(int(int((((JD/7.00)-INT(JD/7))*7)+.5))*9+1),9) TO TODAY
* ----- CALC NAME OF MONTH HERE ----------------------------