fmtdate(3f) - [M_time:DATE_PRINTING] given DAT date-time array return date as string using specified format (LICENSE:MIT)
Synopsis
Description
Options
Returns
Example
Author
License
function fmtdate(values,format) result(timestr)
integer,dimension(8),intent(in) :: values character(len=*),intent(in),optional :: format character(len=:),allocatable :: timestr
The fmtdate(3f) procedure lets you reformat a DAT array in many common formats using a special string containing macro names beginning with %. To see the allowable macros call or see the fmtdate_usage(3f) routine.
values date in a "DAT" array, which is the same format as the values returned by the intrinsic DATE_AND_TIME(3f): dat=[ year,month,day,timezone,hour,& & minutes,seconds,milliseconds]
format string describing how to format the "DAT" array. For a complete description of the formatting macros supported see fmtdate_usage(3f).
timestr formatted output string representing date
Sample program:
program demo_fmtdate use M_time, only : fmtdate implicit none integer :: dat(8) call date_and_time(values=dat) write(*,*)fmtdate(dat,"current date: %w, %l %d, %Y %H:%m:%s %N") end program demo_fmtdateresults:
The current date is Sun, Jul 17th, 2016 01:21:35 PM
John S. Urban, 2015-12-19
Nemo Release 3.1 | fmtdate (3) | February 23, 2025 |