now(3f) - [M_time:DATE_PRINTING] return string representing current time given one of many formats to present with (LICENSE:MIT)
Synopsis
Description
Options
Returns
Example
Author
License
function now(format) result(timestr)
character(len=*),intent(in) :: format ! input format string character(len=:),allocatable :: timestr ! formatted date
The now(3f) function is a call to the fmtdate(3f) function using the current date and time. That is, it is a convenient way to print the current date and time.
format string describing how to format the current date and time. For a complete description of the formatting macros supported see fmtdate_usage(3f).
timestr formatted output string representing date
Sample Program:
program demo_now use M_time, only : now implicit none write(*,*)now("The current date is & &year/month/day hour:minute:second timezone") write(*,*)now("The current date is & &WEEKDAY at HOUR GOOD, MONTH DAY, year") write(*,*)now("The current date is & &%w, %l %d, %Y %H:%m:%s %N") write(*,*)now("iso") end program demo_now Results:
> The current date is 2024/06/28 14:56:36 -0400 > The current date is Friday at 2 PM, June 28th, 2024 > The current date is Fri, Jun 28th, 2024 2:56:36 PM > 2024-06-28T14:56:36-04:00
John S. Urban, 2015
Nemo Release 3.1 | now (3m_time) | August 31, 2024 |