RPN Scripts
RPN Documentation
Submit Script
Conversion
Conversions
Convert
Euro
Euro_Calculator
Soundex
Engineering
Feet_&_Inch
Units
Water
Entertainment
Master_Mind
Sticks!
Finance
Annuity
Euro_Calculator
TVM_Financial_Functions
Math
3D_Vectors_v1.2
Base
Base_Conversions
Complex_Arithmetic
Complex_Math
Discrete_Math
EBBases
Fractions
Fractions
Least
Logs_&_Powers
Misc
Regressions
Scientific
Scientific_Functions
Scientific_Programmable
Simple_Complex_Math
Standard_Normal_Distribution
Trig
Misc
Health
Husband's_Calculator
Physics
Angle_of_View
Depth_of_Field
Physics_Functions
Time
Clock
Julian
Multiple_Timer
Stop5Watch
Stopwatch
Timer
Utility
Board_Foot_Calculator
Calendar_Functions
Checkbook_II
MiniG
Stack_Handling_and_Saving
WindChill
| |
 |
Julian
summary
 |
Date arithmetic in American and European formats
|
instructions
 |
Supports American m/d/y and Eurpoean d/m/y formats, as well as yyyyymmdd and yyyy.mmdd. This can add or subtract a number from a date, get the difference between two dates, calculate Easter for a given year, and get the day of the week. The phase of the moon is also available.
Each function has online help using the RPN show help feature.
Click on "set" to change the date format.
Since the script is longer than the standard clipboard, I use cliphack to copy it.
You can download the .PDB from my site at jcook.net/palm
|
code
 |
RPN.2.d \ Julian arithmetic
[a]#'146097';
[b]#'1461';
[c]#'100';
[d]#'153';
[e]#'1721119';
[q]#'10000';
[f]
\Integer divide
r2g2/r2tH+w;
[g]
\Julian to MDY
ClCe-V
v4*1-CaCf Xc
v4*1-Caxc*-V
v4Cf Xb
xb4*3+CbCf V
xb4*3+vCb*-4+4CfXb
xb5*3-CdCfXa
xb5*3-xaCd*-5+5CfXb
xcCc*v+ Xc
xa#'10'<(xa3+Xa :
xa9-Xaxc1+Xc )
xaxbxc ;
[h]
\ MDY to Julian
Cm XcXbXa
xa2>(xa3-Xa :
xa9+Xaxc1-Xc)
xcCcCfV
xcCcv*-Xc
Cav*4CfCbxc*4Cf+Cdxa*2+5Cf+xb+Ce+ ;
[i]
\ MDY -> F
Cm XcXbXa
xd c(xcCq /xb+Cc/xa+ :
xcCc*xa+Cc*xb+ :
xcCq/ xa+ Cc/ xb+ :
xc xbCc/+ xaCq/+
) ;
[j]
\F -> MDY
g1 xd
c(
g1wXa fCc*g1wXbfCq*Xc :
g1CqCfXc Cq%g1CcCfXaCc%Xb :
g1wXbfCc*g1wXafCq*Xc :
g1wXc fCc* g1wXb fCc*Xa
)
xcCmd1 xa 1 < xa #'12' > | xb 1 < | xb #'31'> |
(D'Invalid date format.|Ok|Change format|' 1=0 (Ct). )
d1
xaxbxc
;
[k]
\Get Easter
g1 0< g2 #'9999'> | g2 g1 w =0 ! | (Cj d2 d2)
Cm Xc xc #'19' % g1 c(4:4:3:4:3:4:4:3:4:4:3:4:4:3:4:3:4:4:3) Xa
c(#'14':3:#'23':#'11':#'31':#'18':8:#'28':#'16':5:#'25':#'13':2:#'22':#'10':#'30':#'17':7:#'27')
Xb
xaxbxc ChV
{v1+Vv7%6=0(B:)}
v ;
[l]
\Validate Julian
g1 g1 Ce> r2 g1 #'5373485'<r3& g2 f0=0 &
(:D'Julian must be 1721120 to\ 5373484|Ok|'d1.) d1;
[m]
\Validate year
g1 #'-1'> r2 g1 Cq<r3& g2 f0=0 &(:D'Year must be 0-9999|Ok|'d1.);
[n]
\Number of days per full moon
#'29.53058868';
[o]
\Offset of days for full moon
#'.6879';
[p]
\Phase of the moon
Cn / Co +;
[t]
\Select format
D'Use yyyy mm and dd for all\formats. E.g.
m.dy=mm.ddyyyy|m.dy|ymd|d.my|y.md|cancel|'
g1 4=0(d1:Xd);
"Julian"
"set: Show the version and\select the date format"
D'Julian Arithmetic version 1.05\By Jim Cook - March 22,
2000|email|format|Ok|'
c(D'jcook@halcyon.com|Ok|' d1:
Ct :
) ;
"moon: Show the phase of the\moon\0=new .25=1Q .5=full .75=3Q"
?1 CjCh Cp f;
"full: Show the next full moon\Enter a date"
?1 CjCh Cp 1H + w 1H + Co - Cn * 1H + w CgCi;
~
"now: Put today on the stack" {TD TMTDTY TD r5 =0(B)} Ci;
"_>j: Convert date to julian\Enter a date" ?1 CjCh ;
"_j>: Convert julian to date\Enter a julian day number" ?1 CgCi ;
"_etr: Get Easter for a year\Enter a year or date" ?1 Ck CgCi ;
~
"+: Add n to a date.\Enter date first\Enter n second" ?2 VCjChv+CgCi;
"-: Subtract n from a date\Enter date first\Enter n second" ?2
VCjChv-CgCi;
"dif: Get the difference\between two dates" ?2 CjChr2CjCh-b ;
"_day: Get the day of the week\Enter a date" ?1 g1 CjCh 7%
c(
D'Monday|Ok|' :
D'Tuesday|Ok|' :
D'Wednesday|Ok|' :
D'Thursday|Ok|' :
D'Friday|Ok|' :
D'Saturday|Ok|' :
D'Sunday|Ok|'
)d1 ;
|
|
|