DateStruct_7c.pl
Notes: 06-21-2004
How old are you, in days? Was June 18, 1979 a Monday? What did Pope Gregory do to the calendar in October 1582?
This utility performs calendar calculations for any year since January 1, 0001 AD. Enter a calendar date in the usual month-day-year numeric format. For example, July 4, 1776 can be entered either as 07-04-1776 or 7-4-1776.
If two dates are entered, the utility prints two sets of calendar statistics, and after that a "days between dates" calculation is displayed. For example, if today is June 26, 2004 (date #1) and a person was born on October 31, 1973 (date #2), they are 11196 days old today. The order of entry for date #1 and #2 doesn't matter.
What do the other calendar calcs mean?
**Leap year:** Since 1582, if a year is evenly divisible by 4, but not by 100 unless also by 400, then it is a leap year. Before 1582, all years evenly divisible by 4 were leap years.
**Day of week:** starts with Sunday = day 1 of the week, ends with Saturday = day 7.
**Day of year:** a day number between 1 and 365 ( or 1 - 366 if leap). This number is used frequently in calendar, annuity and computer calculations.
**Days since 1-1-0001 AD:** continuous, sequentially numbered days. Also just called "day number"; convenient for date and age calculations since all the conversion is already done for us: the number of days "z" between day number "x" in 1921 and day number "y" in 2004 is simply z = x-y.
**Generally accepted Julian date:** another widely used days of age (day number) benchmark. This one goes back to the middle ages when a certain monk believed there was something special about the calendar on **January 1, 4713 BC**. He named the numbered days "Julian" to honor his father Julius. We can add and subtract julian day number just like any other day number; the only thing different is the base date for day number 1.
Resources & Credits:
- Most of the routines in this utility were originally published in the C language in the book PRACTICAL ALGORITHMS, Binstock & Rex, 1995, Addison-Wesley. They were compiled for Mac and PC as a console utility application by Alex Forbes. The routines were converted to Perl (a closely related language) and rebuilt as a web application by Alex in 2004.
- The small-calendar draw routine is from Alex's "my_html_table.pl". It gets its year, month and starting day of week information from the converted C routines.
Be sure to look at the calendar for October 1582, check someone's age in days (remember to enter in both the birthdate and today's date), and find out what day of the week you were born! |