Module for Calculating Julian and Gregorian Dates

Category:
Dates and Math
Type:
Modules
Difficulty:
Intermediate
Author:
Jay

Version Compatibility:

More information:
This is a simple set of two related, public calendar functions

They cover a range of several thousands of years and were originally designed for use in computing long-term astronomical almanac tables.

One function computes the JD number for any given date in history on either the old Julian or the modern Gregorian calendar. The other function reverses the process and determines the calendar date corresponding to a given JD number.

The JD number is the most fundamental number used in calendrical computations and makes possible several other related computations, such as the day of the week for any date in history, days between any two dates and other possibilities.

Simply input a date string, such "4 Jul 1776" and the corresponding JD number is computed, in this case, "2369916". Or, simply input a JD number, such as "2450449", which will return he corresponding date string, in this case, "31 Dec 1996 AD".

These functions form the core around which an advanced calendar or long-term astronomy program may be constructed. The source code contains numerous comments explaining the functions in great detail.


Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

Download calendar_functions.zip