Post Reply 
Daylight Saving
04-04-2014, 01:48 AM
Post: #11
RE: Daylight Saving
I don't have DATE+ or DDAYS, but how about these for a start?

Code:
EXPORT DJ(X)
BEGIN
LOCAL yy,ddd,mi,mm,dd;
yy:=iquo(10000*X+14780,3652425);
ddd:=X-(365*yy+iquo(yy,4)-iquo(yy,100)+iquo(yy,400));
IF (ddd<0) THEN
  yy:=yy-1;
  ddd:=X-(365*yy+iquo(yy,4)-iquo(yy,100)+iquo(yy,400));
END;
mi:=iquo(100*ddd+52,3060);
mm:=(mi+2) MOD 12 + 1;
yy:=(yy+iquo(mi+2,12));
dd:=ddd-iquo(mi*306+5,10)+1;
RETURN yy+(mm/100)+(dd/10000);
END;

This converts a Julian date (a serial number) to a date in the form of YYYY.MMDD (the Prime format), for example 735628 will return 2014.0403 (April 3, 2014).

And this:
Code:
EXPORT JD(X)
BEGIN
LOCAL yy,mm,dd,rr;
yy:=IP(X);
mm:=IP(100*FP(X));
dd:=100*FP(100*X));
mm:=(mm+9) MOD 12;
yy:=yy-iquo(mm,10);
rr:=365*yy+iquo(yy,4)-iquo(yy,100)+iquo(yy,400)+iquo(mm*306+5,10)+(dd-1);
RETURN rr;
END;

This gives you the Julian date from an input date in the form of YYYY.MMDD.

David Motto
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Daylight Saving - ColinJDenman - 03-30-2014, 05:48 PM
RE: Daylight Saving - htom trites - 03-31-2014, 12:09 AM
RE: Daylight Saving - Tim Wessman - 03-31-2014, 02:45 AM
RE: Daylight Saving - htom trites - 03-31-2014, 04:50 AM
RE: Daylight Saving - ColinJDenman - 04-01-2014, 09:26 PM
RE: Daylight Saving - orcinus - 04-02-2014, 09:42 PM
RE: Daylight Saving - Frozen North - 04-03-2014, 01:11 AM
RE: Daylight Saving - orcinus - 04-03-2014, 03:55 AM
RE: Daylight Saving - ColinJDenman - 04-03-2014, 11:49 PM
RE: Daylight Saving - orcinus - 04-04-2014, 01:33 AM
RE: Daylight Saving - ColinJDenman - 04-04-2014, 01:55 AM
RE: Daylight Saving - DGM - 04-04-2014 01:48 AM
RE: Daylight Saving - ColinJDenman - 04-04-2014, 07:27 AM
RE: Daylight Saving - orcinus - 04-04-2014, 01:54 PM
RE: Daylight Saving - debrouxl - 04-04-2014, 06:29 AM
RE: Daylight Saving - ColinJDenman - 04-04-2014, 07:22 AM
RE: Daylight Saving - htom trites - 04-04-2014, 06:36 PM



User(s) browsing this thread: 2 Guest(s)