YEAR4()

Fortran version:

    INTEGER FUNCTION  YEAR4( YY )
        INTEGER, INTENT(IN   ) :: YY

C version:

None. But can probably be called as:
#if __hpux || _AIX
#define   YEAR4 year4_
#elif  __sgi || __sun || __osf__ || __mips__
#define   YEAR4 year4_
#enduf

    int YEAR4( const int *yy )

Summary:

YEAR4() returns the 4-digit year corresponding to the argument YY. Controlled by two environment variables:
YEAR4_BASE:
base century for the result (default value 1900)
YEAR4_PIVOT
cutoff year (YY) for decision between base century and the century after it (default value 70)
IF YY > YEAR4_BASE , YEAR4 returns YY. Otherwise, YY must be in the range 0-99

Preconditions:

If you wish to use some other year than 1970 as the transition year for consecutive centuries,
setenv YEAR4_BASE <century> setenv YEAR4_PIVOT <year>

Fortran Usage:

For Fortran-90 declarations and interface checking:
    USE M3UTILIO
    

In the following, note that V is out-of-range - the call to YEAR4(V) will generate an out-of-range message and stop the program.

    ...
    ...
    INTEGER   YEAR4
    INTEGER   P, Q, R, S, T, U, V
    ...
    ( suppose defaults:  YEAR4_BASE = 1900, YEAR4_PIVOT = 1970,
    ( P = 15, Q = 69, R = 70, S = 93, T = 1985, U = 2020, V = 111 )
    WRITE (*,* ) YEAR4( P )	!  is 2015
    WRITE (*,* ) YEAR4( Q )	!  is 2069
    WRITE (*,* ) YEAR4( R )	!  is 1970
    WRITE (*,* ) YEAR4( S )	!  is 1993
    WRITE (*,* ) YEAR4( T )	!  is 1985
    WRITE (*,* ) YEAR4( U )	!  is 2020

    WRITE (*,* ) YEAR4( V )     !  ERROR -- generates out-of-range message
    ...


Previous: WKDAY

Next: YR2DAY

Up: Date-Time Manipulation Routines

To: Models-3/EDSS I/O API: The Help Pages