   Date Conversions  Gregorian or Julian Calendar Date to Julian Day Count See Also: JD2CALXXX() and JD2GREG() Notes: Julian day number (JD) is an astronomical calendar system whose largest unit is the day. Each day has a value one greater than the next and dates never cycle back to zero. For instance at noon on January 1, 2000 the JD was: 2,451,545. This continuous day count makes it easy to manipulate dates mathematically -- there are no leap days to worry about. For most of the current epoch in the Western world two widespread civil calendars have been in use. The Julian calendar (no relation to the JD), which commenced the last B.C. century in Roman times, and the Gregorian calendar that was phased in worldwide from the 16th to the 20th century A.D. and is the calendar on your wall. See Julian and Gregorian Calendars for information on what these calendars achieved compared to prior attempts. Julian day numbers start at noon (12 UT) and civil calendar dates start at midnight (0 UT). Therefore conversions from the start of a civil calendar day to JD dates result in a JD that is halfway over -- ending in .5 days. To avoid time-zone confusion you MUST convert day/time to UT if requiring a JD for a certain time during that day. The first function below will convert Julian or Gregorian calendar dates to JD. The second and third functions are derived from the first to only handle the conversion of Gregorian dates -- the conversion of most use for current calculations. The third function differs from the first two in that input is a date in decimal-year form -- 1999.5 for instance. This is useful in determining the JD of a midyear epoch, such as used in the Astronomical Almanac section H: Bright Stars.
 Resources: [AA: pp. 60-61]; [ESAA: p. 604, 606]; [S&T - May, 1984: pp. 454, 455] Auxiliary functions for Civil Calendar Date to Julian Date conversion: Adjust Month Number: Adjust Year Number: Get Century Number: Get Leap-Year Count: Constant value for JD at Noon, January 1, 2000: Function to convert Gregorian/Julian Year, Month and Day format to Julian day number Input: Year and Month as integer, Day can be fractional, IsGREG is 1 if Gregorian date input, any other value is Julian calendar. Output: is JD in decimal. For BC era take year as negative and add one: 2 BC is -2+1 = -1. This is to compensate for the fact that there was is no year zero in our calendar system. JD does not exist before January 1.5 (noon UT of the first day), 4713 BC. Function to convert Gregorian Year, Month and Day format to Julian day number Input: Year and Month as integer, Day can be fractional Output: is JD in decimal. Same restrictions as above, but only converts Gregorian dates. Function to convert Gregorian Decimal Year to Julian day number Input: Year as a decimal number. Output: JD as a decimal number. Example: Convert Gregorian date/time to Julian day number Input year, month and day fraction (default are User Constants):   So we have:   The JD for this date is: Fractional JD Check The fractional part of JD should be equal to the time from noon (0.5) to the fraction part of DAYDec. Example: Find Julian Date for mid-Year Epoch. Input year of interest: For this year: Resulting JD:    Julian Day Count to Gregorian or Julian Calendar Date See Also: CAL2JD() and GREG2JD() Notes: The functions here will determine the year, month, and day equivalent of any non-negative Julian day number. The first set of functions will return dates in Julian or Gregorian form based on the setting of the IsGreg flag: -1 = auto, 0 = Julian, 1 = Gregorian. In auto mode dates returned from the span of the BC years to October 4, 1582 AD are in the Julian calendar and dates after that are in the Gregorian calendar. See Julian and Gregorian Calendars for more about this cutoff date. The second set of functions are convenient for converting JD to Gregorian only. Resources: [AA: p. 63]; [ESAA: p. 604, 606] Auxiliary functions used for JD to Year, Month and Date conversion functions:          The following three functions will convert JD to Calendar Date Input: JD and IsGREG flag for calendar return type (see text above): -1 = auto, 0 = Julian, 1 = Gregorian Output: Indicated Day, Month, or Year in UT time zone
 JD to Calendar Day of Month: JD to Calendar Month: JD to Calendar Year: Formatting Matrix for above calendar equations Input: JD and IsGREG flag (see above equation) Output: Date displayed in year, month and day format inside a matrix. Convert JD to Gregorian Date with the following three functions Input: JD Output: Indicated Day, Month, or Year in UT time zone JD to Gregorian Day of Month: JD to Gregorian Month: JD to Gregorian Year: Formatting Matrix for above Gregorian equations Input: JD Output: Date displayed in year, month and day format inside a matrix. Function to convert Julian day number to Gregorian Decimal Year Input: JD as a decimal number. Output: Year as a decimal number. Example: Convert JD to an epoch year Input Julian day number: Resulting epoch year:  Example: Demonstrates how one date can be interpreted between calendar systems. Input Julian day number: Results using various settings of IsGreg flag: Julian Calendar Forced Julian calendar result Auto Select Calendar Returns Gregorian calendar after Oct 4, 1582 Gregorian Calendar Forced Gregorian calendar result
 Result using dedicated Gregorian Calendar function: Another way of achieving Forced Gregorian calendar result Julian Day Count to Julian Centuries from J2000 Notes: Many functions use the Julian day count in terms of Julian centuries (JC) from the year 2000. A Julian century is 100 years of 365.25 days each. Dates prior to the year 2000 will have a negative Julian century value. Resources: [AA: p. 83]; [TAA: p. B6] Julian Centuries from J2000 epoch Input: Julian day number in decimal Output: decimal number of JC from J2000. Example: Given Julian day count, return Julian centuries from J2000: Input year, month and day fraction to generate JD from (default are User Constants):   So we have:   The Julian day number for this date is: yields: Find JC from J2000:  Returns Julian Day Number at 0.0 UT for a Given Julian Day Count Notes: Because Julian days start at noon UT, the Julian day integer advances over the course of a civil day. This system keeps the integer part of Julian day numbers constant at night when most astronomers are working. The function here returns the Julian day at midnight, the start of the civil day, as an aide in determining the calendar day represented by this day number. Determine JD at Zero Hours UT of a given JD date Input: Julian day count. Output: JD at 0 UT. Example: Determine Gregorian calendar date of JD Input JD: Find JD at civil midnight: yields: Check solution: Look at input JD and JD at civil midnight (JD0UT) translated into calendar dates. Year and month should match; the day number from JD0UT should be the truncated day number from JD.   Astro Utilities Electronic Book Copyright © 1999 Pietro Carboni. All rights reserved.