dateToDays

Computes the number of days from January 1, 1900, to the given date.

Synopsis

dateToDays (day, month, year)

Required Arguments

int day (Input)
Day of the input date.
int month (Input)
Month of the input date.
int year (Input)
Year of the input date. The year 1950 would correspond to the year 1950 A.D., and the year 50 would correspond to year 50 A.D.

Return Value

Number of days from January 1, 1900, to the given date. If negative, it indicates the number of days prior to January 1, 1900.

Description

The function dateToDays returns the number of days from January 1, 1900, to the given date. The function dateToDays returns negative values for days prior to January 1, 1900. A negative year can be used to specify B.C. Input dates in year 0 and for October 5, 1582, through October 14, 1582, inclusive, do not exist; consequently, in these cases, dateToDays issues a terminal error.

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 dateToDays to compute the number of days from January 15, 1986, to February 28, 1986.

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

day0 = dateToDays(15, 1, 1986)
day1 = dateToDays(28, 2, 1986)
print("Number of days = ", day1 - day0)

Output

Number of days =  44