-
Notifications
You must be signed in to change notification settings - Fork 10
Julian Calendar Conversion
Multiple times throughout the script, we see the use of Julian calendar dates to signify our traditional Gregorian Calendar dates. In order to edit these dates, the staff would need to know the value of the Julian conversion of the Gregorian date they wish to use. There are two ways to do this. They can either use a website, such as OnlineConversion.com, or a Javascript script.
For the website, the staff would simply need to enter the Gregorian date into the website, and it will give the staff the Julian conversion of their desired date. Then, this date would be copied into the desired variables within the code. Or, if the staff wished to convert the Julian date to a Gregorian date, they would simply repeat the above steps, but enter in the Julian date instead.
For the Javascript script, the following code would be used to convert a Gregorian calendar date to a Julian date.
var jd, year, month, day, i, j, k;
year = 1970;
month = 1;
day = 1;
i = year;
j = month;
k = day;
jd = Math.floor(k - 32075 + 1461 * (i + 4800 + (j - 14) / 12) / 4 + 367 * (j - 2 - (j - 14) / 12 * 12) / 12 - 3 * ((i + 4900 + (j - 14) / 12) / 100) / 4);
console.log("julian date = " + jd);
In this code, the user would simply need to change the year, month, and day variables to the Gregorian date they wish to convert. This script will convert that date into a Julian date, which can be used within the program.
In order to convert a Julian date to a Gregorian date, they would use this script below.
var jd, year, month, day, l, n, i, j, k;
jd = 2440588;
l = jd + 68569;
n = Math.floor(Math.floor(4 * l) / 146097);
l = l - Math.floor((146097 * n + 3) / 4);
i = Math.floor(4000 * (l + 1) / 1461001);
l = l - Math.floor(1461 * i / 4) + 31;
j = Math.floor(80 * l / 2447);
k = l - Math.floor(2447 * j / 80);
l = Math.floor(j / 11);
j = j + 2 - 12 * l;
i = 100 * (n - 49) + i + l;
year = i;
month = j;
day = k;
console.log("year = " + year + ", month = " + month + ", day = " + day);
In this code, the user would simply need to change the jd variable to the Julian date they wish to convert. Then, this script will output the desired Gregorian calendar date.