From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 10-APR-1991 16:25:38.62
To:	ARISIA::EVERHART
CC:	
Subj:	re: Julian date

From:	RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP@CRDGW2
To:	Everhart@Arisia@MRGATE

Received:  by crdgw1.ge.com (5.57/GE 1.97)
	 id AA10165; Wed, 10 Apr 91 14:45:31 EDT
Message-Id:  <9104101845.AA10165@crdgw1.ge.com>
Received: From SCFB.NWC.NAVY.MIL by CRVAX.SRI.COM with TCP; Wed, 10 APR 91 10:40:42 PDT
Date: 10 Apr 91 10:20:00 PDT
From: "351M::LEVINE" <levine%351m.decnet@scfb.nwc.navy.mil>
Subject: re: Julian date
To: "info-vax" <info-vax@sri.com>

	A check of the CACM (Collected algorithms of the ACM), found
algorithm 199  "Conversions Between Calendar Date and Julian Day Number"
by Robert G Tantzen, A.F. Missile Development Center, Holloman AFB,N.M.

written in algol
jday	convert d,m,y (gregorian) to julian
jdate	convert julian to d,m,y(gregorian)

procedure jday(d,m,y,j)
integer d,m,y,j;
begin
	integer c,ya;
	if(m>2) then 		m := m-3
		else begin	m := m+9; y := y-1 end;
	c:=y/100;
	ya := y-100*c;
	j := (146097*c)/4+(1461*ya)/4+(153*m+2)/5+d+1721119
end jday

procedure jdate(j,d,m,y)
integer j,d,m,y;
begin
	j := j=1721119;
	y :=(4*j-1)/146097;
	j := 4*j-1-146097*y;
	d :=j/4;
	j := (4*d+3)/1461;
	d := 4*d+3-1461*j;
	d := (d+4)/4;
	m := (5*d-3)/153;
	d := 5*d-3 -153*m;
	d := (d+5)/5
	y := 100*y+j;
	if m<10 then 		m := m+3
		else begin	m := m-9; y := y+1 end;
end jdate

Michael N. LeVine  Naval Weapons Center, China Lake, Ca 93555, USA
Internet: levine%fidler.decnet@scfb.nwc.navy.mil,levine%fidler.decnet@26.3.0.85
(619) 939-2614  avn  437-2614 

 "Waiter, there's a bug in my soup!"        
 "No, Sir, it's not a bug, it's a feature!" 


