DATETODAYS Function

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

Usage

result = DATETODAYS([day[, month[, year]]])

Input Parameters

day—Day of the input date.

month—Month of the input date.

year—Year of the input date. The year 1950 corresponds to the year 1950 A.D., and the year 50 corresponds to year 50 A.D.

Returned Value

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

Discussion

Function DATETODAYS returns the number of days from January 1, 1900, to the given date and 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 an error.

The Gregorian calendar starts 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.

d0 = DATETODAYS(15, 1, 1986)
d1 = DATETODAYS(28, 2, 1986)
PM, d1 - d0, Title = 'Number of days from 1/15/86 to 2/28/86'