Manual Reference Pages  - now (3m_time)

NAME

now(3f) - [M_time:DATE_PRINTING] return string representing current time given one of many formats to present with (LICENSE:MIT)

CONTENTS

Synopsis
Description
Options
Returns
Example
Author
License

SYNOPSIS

function now(format) result(timestr)

    character(len=*),intent(in)     :: format  ! input format string
    character(len=:),allocatable    :: timestr ! formatted date

DESCRIPTION

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.

OPTIONS

format string describing how to format the current date and time. For a complete description of the formatting macros supported see fmtdate_usage(3f).

RETURNS

timestr
  formatted output string representing date

EXAMPLE

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

AUTHOR

John S. Urban, 2015

LICENSE

    MIT


Nemo Release 3.1 now (3m_time) August 31, 2024
Generated by manServer 1.08 from 327cbafe-c7dd-4e0e-964b-13eb0bf5667b using man macros.