Fortran Library Reference

date: Get Current Date as a Character String


Note -

This routine is not "Year 2000 Safe" because it returns only a two-digit value for the year. Programs that compute differences between dates using the output of this routine may not work properly after 31 December, 1999. Programs using this date() routine will see a runtime warning message the first time the routine is called to alert the user. See date_and_time() as a possible alternate routine.


The subroutine is called by:

call date( c )

c

CHARACTER*9

Output 

Variable, array, array element, or character substring 

The form of the returned string c is dd-mmm-yy, where dd is the day of the month as a 2-digit number, mmm is the month as a 3-letter abbreviation, and yy is the year as a 2-digit number (and is not year 2000 safe!).

Example: date:


demo% cat dat1.f 
* dat1.f -- Get the date as a character string. 
    character c*9 
    call date ( c ) 
    write(*,"(' The date today is: ', A9 )" ) c 
    end
demo% f77 -silent dat1.f  
   "dat.f", line 2: Warning: Subroutine "date" is not safe after  
       year 2000; use "date_and_time" instead
demo% a.out 
Computing time differences using the 2 digit year from subroutine 
       date is not safe after year 2000.
 The date today is: 9-Jul-98 
demo% 

See also idate() and date_and_time().