Most of the time related function come from the various
Asto/Navigation texts. Here is a copy of some of the standard
functions that I have collected over the years.


Andy


JD from Calendar Date

Let Y be the year
    M be the month number
    D be the day number (with decimals if any)
Of the given Calendar date

If M>2 leave Y and M unchanged

If M=1 or 2 replace Y by Y-1 and M by M+12

(ie if the date is in jan or feb it is considered
 to be in the 13th or 14th month of the preceeding year)

In the gregorian calendar calculate:

A = INT (y/100)   B= 2 - A + INT (A/4)

In the Julian calendar, take B= 0

The required JD ids then

JD= INT(365.25(Y+4716)) + INT(30.6001(M+1)) + D + B - 1524.5


Example: the launch of Sputnik was 1957, Oct 4.81

Y=1957 M = 10 D=4.81
M>2 so leave Y&M unchanged

As the date is in the Gregorian calendar

A=INT(1957/100) = INT(19.57) = 19
B = 2 - 19 + INT(19/4) = 2 - 19 + 4 = -13

JD = INT(365.25*6673) + INT(30.6001*11) + 4.81 - 13 - 1524.5
JD = 2436116.31


Example calculate the JD for JAn 27 at 12h of the year 333

M = 1, so Y=333-1 = 332 and M = 1+12 = 13
Because date is in julian calendar B=0

JD = INT(365.25*5048) + INT(30.6001*14)+27.5+0-1524.5
JD = 1842713.0

Note if you are only interested in dates between 1900 march 1
and 2100 feb 28 set B to = -13


Calendar date from JD

(not valid for negitive JD's)

Add 0.5 to the JD
Let z be the integer part and F the fractional part

If z < 2299161 take A = z
else

a = INT(Z-1867216.25/36524.25)
A = z + 1 + a - INT(a/4)

Then Calculate

B = A + 1524
C = INT(B - 122.1/365.25)
D = INT(365.25 C)
E = INT(B - D/30.6001)

The day of month with decimals is

B - D - INT(30.6001 E) + F

The month Number is

E - 1 if E < 14
E - 13 if E = 14 or 15

The year is
C - 4716 if m>2
C - 4715 if m = 1 or 2

example

calc the calendar date for JD 2436116.31

2436116.31 + 0.5 = 2436116.81
z = 2436116 F = 0.81

z > 2299161 so:

a = INT 2436116 - 1867216.25/36524.25) = 15

A = 2436116+1+15 - INT(15/4) = 2436129

B = 2437653
C = 6673
D = 2437313
E = 11

day of month = 4.81
Month  m = E-1 (because E<14)
Year = C - 4716 = 1957 (because m > 2)

Day of week

calculate the JD of the date at 0h and add 1.5

Divide the result by 7

the remainder will indicate the day of the week 

0 = sunday
1 = mon
...
6 sat

Day of the year

The nukber N of a day in the year

N = INT(275 M /9) - K * INT(M+9/12) + D - 30

where M is the month number, D the day of the month
K = 1 for leap year
K = 2 for common year

(N = 1 for Jan 1st)

Date from Day number

M = INT[ 9(K+N)/275 + 0.98]
If N<32 then M=1
D = N - INT(275M/9) + K * INT(M+9/12) + 30

Note that Julian day numbers traditionally begin at
Greenwich mean NOON that is 12h Universal Time.

Reply via email to