Julian Day Numbers - Using Calgo #199

The Julian day number counts the number of days since noon on Monday 01 January 4713 BCE (Julian calendar) or Monday 24 November -4713 (Gregorian calendar). This system, widely used by astronomers, was proposed by Julius J. Scaliger in 1583. [Note: BCE is the new 'modern' term for BC. BCE stands for 'Before the Common Era'; BC stands for 'Before Christ'. Likewise, while not used here, CE is the new 'modern' term for AD. CE stands for 'Common Era'; AD stands for 'anno Domini'.]

A good reference on Calendrical Calculations is the book "Calendrical Calculations" by Nachum Dershowitz & Edward M. Reingold (ISBN 0-521-56474-3; 1997).

Please note that ALL short form dates use the format "dd/mm/yyyy".


Gregorian Date to Julian Day Number

"JDAY" converts a calendar date, Gregorian calendar, to the corresponding Julian day number. From the given day, month and year, the Julian day number is computed without using tables, as follows:

	if m > 2 then
	    m = m - 3
	else
	    m = m + 9 ; y = y - 1
	end if
	
	c = y / 100 ; ya = y - 100 * c ;
	j = (146097 * c) / 4 + (1461 * ya) / 4 + (153 * m + 2) / 5 + d + 1721119
	
Variables (all variables and results are integers):
	y = year (eg. 1999);  m = month;  d = day;  c = century part of year (eg. 19);
ya = decade part of year (eg. 99); j = Julian Day Number

The following PHP converter can be used to convert a Gregorian date into a Julian day number.

Please enter the Gregorian Date you wish to convert below:

Day        Month        Year   

Please select your preferred background colour for the output screen:

Return to the top of this page


Julian Day Number to Gregorian Date

"JDATE" converts a Julian day number to the corresponding calendar date, Gregorian calendar. The Julian day number is used to calculate the calendar date (day, month & year) without using tables, as follows:

	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
	    m = m - 9 ; y = y + 1
	end if
	
Variables (all variables and results are integers):
	y = year (eg. 1999);  m = month;  d = day;  j = Julian Day Number		

The following PHP converter can be used to convert a Julian date into a Gregorian day number.

Please enter the Julian day Number you wish to convert here:   Julian Day Number  

Please select your preferred background colour for the output screen:

Return to the top of this page


Reference: Collected Algorithms from CACM.
Algorithm #199 - "Conversions between Calendar Date and Julian Day Number"
URL for this homepage: http://www.tip.net.au/~pmyers/General/JulianDates.htm

This and related pages can be downloaded here in the form of a 'ZIP' file. Any assistance that you may be able to provide to get these pages to work would be appreciated.

Modifications to this page © 2001, Paul Myers