Oracle Solaris Studio 12.4 Man Pages

Exit Print View

Updated: January 2015
 
 

date(3F)

Name

date - 以字符形式返回日期

Synopsis

subroutine date (str)
character*9 str

Description

date 子例程获取当前日期并将其放置到字符串 str 中。形式为 dd-mmm-yy

dd 是月中的天,以两位数的整数表示。

mmm 是月份名称,以三字母缩写形式表示:Jan、Feb、Mar、Apr、May、Jun、Jul、Aug、Sep、Oct、Nov、Dec。

yy 是年份,以两位数的整数表示。

Y2K 警报:date() 不是 Y2K 安全的!因为 date 返回一个 2 位数的年份,所以不应当使用它来比较未考虑此情况的日期。例程 fdate(3F)、idate(3F) 和 date_and_time(3F) 返回 4 位数的年份,因此可以改用它们。

因为 date 不是 Y2K 安全的,所以使用此例程的程序在编译和执行时将生成警告消息。

Notes

用法:

 
character*9 str
call date (str)

示例:

 
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》