daysToDate

Gives the date corresponding to the number of days since January 1, 1900.

Synopsis

daysToDate (days, day, month, year)

Required Arguments

int days (Input)
Number of days since January 1, 1900.
int day (Output)
Day of the output date.
int month (Output)
Month of the output date.
int year (Output)
Year of the output date. The year 1950 would correspond to the year 1950 A.D., and the year 50 would correspond to year 50 A.D.

Description

The function daysToDate computes the date corresponding to the number of days since January 1, 1900. For a negative input value of days, the date computed is prior to January 1, 1900. This function is the inverse of function dateToDays.

The beginning of the Gregorian calendar was the first day after October 4, 1582, which became October 15, 1582. Prior to that, the Julian calendar was in use.

Example

The following example uses daysToDate to compute the date for the 100th day of 1986. This is accomplished by first using PyIMSL function dateToDays to get the “day number” for December 31, 1985.

from __future__ import print_function
from pyimsl.math.daysToDate import daysToDate
from pyimsl.math.dateToDays import dateToDays

day = []
month = []
year = []
day0 = dateToDays(31, 12, 1985)
daysToDate(day0 + 100, day, month, year)
print("Day 100 of 1986 is (day-month-year)",
      day[0], "-", month[0], "-", year[0])

Output

Day 100 of 1986 is (day-month-year) 10 - 4 - 1986