NDAYS
This function computes the number of days from January 1, 1900, to the given date.
Function Return Value
NDAYS — Function value. (Output)
If NDAYS is negative, it indicates the number of days prior to January 1, 1900.
Required Arguments
IDAY — Day of the input date. (Input)
MONTH — Month of the input date. (Input)
IYEAR — Year of the input date. (Input)
1950 would correspond to the year 1950 A.D. and 50 would correspond to year 50 A.D.
FORTRAN 90 Interface
Generic: NDAYS (IDAY, MONTH, IYEAR)
Specific: The specific interface name is NDAYS.
FORTRAN 77 Interface
Single: NDAYS (IDAY, MONTH, IYEAR)
Description
Function NDAYS returns the number of days from January 1, 1900, to the given date. The function NDAYS returns negative values for days prior to January 1, 1900. A negative IYEAR 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, NDAYS issues a terminal error.
Comments
1. Informational error
Type | Code | Description |
---|
1 | 1 | The Julian calendar, the first modern calendar, went into use in 45 B.C. No calendar prior to 45 B.C. was as universally used nor as accurate as the Julian. Therefore, it is assumed that the Julian calendar was in use prior to 45 B.C. |
2. The number of days from one date to a second date can be computed by two references to NDAYS and then calculating the difference.
3. 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. NDAYS makes the proper adjustment for the change in calendars.
Example
The following example uses NDAYS to compute the number of days from January 15, 1986, to February 28, 1986:
USE NDAYS_INT
USE UMACH_INT
IMPLICIT NONE
INTEGER IDAY, IYEAR, MONTH, NDAY0, NDAY1, NOUT
!
IDAY = 15
MONTH = 1
IYEAR = 1986
NDAY0 = NDAYS(IDAY,MONTH,IYEAR)
IDAY = 28
MONTH = 2
IYEAR = 1986
NDAY1 = NDAYS(IDAY,MONTH,IYEAR)
CALL UMACH (2, NOUT)
WRITE (NOUT,*) 'Number of days = ', NDAY1 - NDAY0
END
Output
Number of days = 44
Published date: 03/19/2020
Last modified date: 03/19/2020