# Chapter 1 – Time (Julian Date)

**Posted:**March 16, 2013

**Filed under:**Time, ZX Spectrum Astronomy |

**Tags:**Calendars, Gregorian Calendar, Julian Calendar, Julian Date, Maurice Gavin, Measuring Time, Programming, Sinclair Basic, Time, ZX Spectrum Astronomy Leave a comment

Measuring time, different calendars

Spectrum Calendar, prints a calendar for any year after 1582

Julian Date, works out the Julian Day number for any date

Julian Calendar, prints a complete Julian Day calendar for any month of any year

Day of the Week, identifies the day of the week for any date

Interval Days, the interval between any two dates from a few minutes to centuries apart

Local Sidereal Time, calculates ‘star time’ for any date and hour

Reaction Timer, find out your reaction time to get accurate readings.

## Julian Date

Astronomers are naturally interested in events far removed from Earth which sometimes have a periodicity quite unrelated to our calendar. Timing these events by quoting the date when they occur would be tiresome, so astronomers resort to a very simple counting system called the Julian Day number or JD for short.

The reference date is noon (GMT) January 1^{st} 4713BC. Every date has a separate JD beginning at noon – currently this is a seven-figure number in excess of 2,400,000. That particular JD was passed on November 17^{th} 1858 and is sometimes used as a reference date called the Modified Julian Day number (MJD).

The following routine calculates the JD for any INPUT date after October 1582 – the month the current (Gregorian) calendar was introduced. Decimal days can be included in the JD so that an event timed even to a fraction of a second on a particular day can be written as a single, if long, number. For example:

JD no 2445470.501 = 1983 May 16 (Monday) 0h 01m 26.4s (GMT).

Eg 1 minute and 26.4 seconds after midnight on Monday 16^{th} May 1983 (GMT).

It can be seen that, for computing purposes, the JD is much more convenient than handling dates from the regular calendar.

**10 PRINT “Julian Date (0hUT)=”;
30 LET d$=”SatSunMonTueWedThuFriJanFebMarAprMayJunJulAugSepOctNovDec”
40 INPUT “Year “;y'”Month “;m'”Day “;d
50 LET m$=d$(m*3+19 TO m*3+21)
100 GO SUB 1000: LET j=jj+d
160 LET q=j-7*INT (j/7)+1
170 LET e$=d$(3*q-2 TO 3*q)
200 PRINT j+1720996.5
300 PRINT y;” “;m$;” “;d;”=”;e$;”day”: PRINT : GO TO 1
1010 LET yy=y/100: LET y1=INT yy: LET yt=y/400: LET y4=INT yt
1030 LET jj=INT (365.25*(y-(m<3)))+INT (30.6001*(m+1+12*(m<3)))-y1+y4
1040 IF yy=y1 AND yt<>y4 AND m<3 THEN LET jj=jj+1
1050 RETURN
9900 REM **************************************************
9990 SAVE “Jcal”**

Image taken from the above program showing Julian dates for 16/05/2013, 02/12/1999 and 16/05/1983