Oracle Solaris Studio 12.4 Man Pages

Exit Print View

Updated: January 2015
 
 

date(3F)

Name

date - return date in character form

Synopsis

subroutine date (str)
character*9 str

Description

The date subroutine gets the current date and puts it into the character string str. The form is dd-mmm-yy.

dd is the day of the month as a two-digit integer.

mmm is the name of the month as a three-letter abbreviation: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec.

yy is the year as a two-digit integer.

YEAR 2000 ALERT: date() IS NOT Y2K SAFE! Since date returns a 2-digit year, it should not be used to compare dates without taking this into account. Routines fdate(3F), idate(3F), and date_and_time(3F) do return 4-digit years and could be used instead.

Because date is not Y2K safe, programs using this routine will generate warning messages at compilation and execution.

Notes

Usage:

 
character*9 str
call date (str)

Example:

 
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 dat1.f
dat1.f:
 MAIN:
"dat1.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: 2-Oct-97
demo%

Files

libfui.a

See also

idate(3F), ctime(3F), fdate(3F), date_and_time(3F)

FORTRAN 77 Reference Manual