IMSL_DATETODAYS

Syntax | Return Value | Arguments | Discussion | Example | Version History

The IMSL_DATETODAYS function computes the number of days from January 1, 1900, to the given date.

Note
This routine requires an IDL Advanced Math and Stats license. For more information, contact your ITT Visual Information Solutions sales or technical support representative.

Syntax

Result = IMSL_DATETODAYS([day[, month[, year]]])

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.

Arguments

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.

Discussion

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

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

Version History

6.4

Introduced