HP Forums
Calendar calculations. - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Calendar calculations. (/thread-2850.html)



Calendar calculations. - ggauny@live.fr - 01-13-2015 12:33 PM

Here is a little code which is needed for subject. It determine if year is Julian or Gregorian also if year is Leap or not. It is important to build a calendar.
Code:
EXPORT CALENDRIER()
BEGIN
LOCAL DATE:=0,J:=0,M:=0,AN:=0;
LOCAL GREG:=0,JUL:=0,GBISS:=0,JBISS:=0;
INPUT(DATE,"CALENDRIER","JJ.MMAAAA");

J:=IP(DATE);
M:=IP(FP(DATE)*100);
AN:=IP(FP(FP(DATE)*100)*10000);

IF(AN+M/100+J/10000)>1582.10145
  THEN 1▶GREG;
  ELSE 1▶JUL;
END;
IF (AN>1582 AND(irem(AN,4)==0 AND irem(AN,100)≠0) OR irem(AN,400)==0)
   THEN 1▶GBISS;0▶JBISS
   ELSE 
     IF (AN<1582 AND irem(AN,4)==0)
   THEN 1▶JBISS;0▶GBISS
   END;
END;
IF GREG==1 AND GBISS==1 THEN PRINT(AN+"GREG BISS");END;
IF GREG==1 AND GBISS==0 THEN PRINT(AN+"GREG ORDI");END;
IF JUL==1 AND JBISS==1 THEN PRINT(AN+"JUL BISS");END;
IF JUL==1 AND JBISS==0 THEN PRINT(AN+"JUL ORDI");END;
END;
After we are abble to do almost everythings for calendars.
Gérard.


RE: Calendar calculations. - Thomas_Sch - 01-13-2015 02:46 PM

There are also a lot of date functions from Wolfgang at
http://www.hpmuseum.org/forum/thread-1272-post-19101.html#pid19101

regards, Thomas


RE: Calendar calculations. - ggauny@live.fr - 01-13-2015 04:39 PM

(01-13-2015 02:46 PM)Thomas_Sch Wrote:  There are also a lot of date functions from Wolfgang at
http://www.hpmuseum.org/forum/thread-1272-post-19101.html#pid19101

regards, Thomas

Thanks a lot, Yes great job !
Good evening.
Cheers. Gérard.