fmtdate_usage(3f) - [M_time:DATE_PRINTING] display macros recognized by fmtdate(3f) and now(3f) (LICENSE:MIT)
Synopsis
Description
Options
Example
Author
License
subroutine fmtdate_usage(indent)
integer,intent(in),optional :: indent
The fmtdate_usage(3f) subroutine displays the formatting options available for use in procedures such as fmtdate(3f) and now(3f). It is typically used to produce up-to-date help text in commands that use the M_time(3fm) module, so that the formatting information only needs maintained in one place (this routine) and is easily displayed so users can quickly obtain a description of the formatting macros.
indent how many spaces to prefix the output with, so that calling programs can position the output. Default for this optional parameter is three (3).
Sample Program:
program demo_fmtdate_usage use M_time, only : fmtdate_usage implicit none call fmtdate_usage() ! see all formatting options end program demo_fmtdate_usageresults (actually call the routine to ensure this is up to date):
Description ExampleHelp: %? -- call fmtdate_usageBase time array: (1) %Y -- year, yyyy 2016 (2) %M -- month of year, 01 to 12 07 (3) %D -- day of month, 01 to 31 29 %d -- day of month, with suffix (1st, 2nd,...) 29th (4) %Z -- minutes from UTC -0240m %z -- -+hh:mm from UTC -04:00 %T -- -+hhmm from UTC -0400 (5) %h -- hours, 00 to 23 10 %H -- hour (1 to 12, or twelve-hour clock) 10 %N -- midnight< AM <=noon; noon<= PM <midnight AM (6) %m -- minutes, 00 to 59 54 (7) %s -- sec, 00 to 59 08 (8) %x -- milliseconds 000 to 999 521 Conversions: %E -- Unix Epoch time 1469804048.5220029 %e -- integer value of Unix Epoch time 1469804049 %F -- Modified Julian date 57599.121 %f -- integer value of Modified Julian Date 57599 %G -- Baseday and Seconds (57599,40223.12139393) %g -- Baseday seconds 40223.12139393 %J -- Julian date 2457599.121 %j -- integer value of Julian Date(Julian Day) 2457599 %O -- Ordinal day (day of year) 211 %o -- Whole days since Unix Epoch date 17011 %U -- day of week, 1..7 Sunday=1 6 %u -- day of week, 1..7 Monday=1 5 %i -- ISO week of year 1..53 30 %I -- iso-8601 week with weekday: (yyyy-Www-d) 2016-W30-5 Names: %l -- abbreviated month name Jul %L -- full month name July %w -- first three characters of weekday Fri %W -- weekday name Friday %p -- phase of moon New %P -- percent of way from new to full moon -1% %X -- day of month in English twenty-first Literals: %% -- a literal % % %t -- tab character %b -- blank character %B -- exclamation(bang) character %n -- new line (system dependent) %q -- single quote (apostrophe) %Q -- double quote Duration: %a -- Time since now as d-h:m:s 1-12:34:30 %A -- TIme since now as seconds 12810.4500 Program timing: %c -- CPU_TIME(3f) output .21875000000000000 %C -- number of times this routine is used 1 %S -- seconds since last use of this format .0000000000000000 %k -- time in seconds from SYSTEM_CLOCK(3f) 723258.812 %K -- time in clicks from SYSTEM_CLOCK(3f) 723258812
If no percent (%) is found in the format one of several alternate substitutions occurs.
If the format is composed entirely of one of the following keywords the following substitutions occur:
iso-8601, iso ==> %Y-%M-%DT%h:%m:%s%z iso-8601W, isoweek ==> %I 2016-W30-5 sql ==> %Y-%M-%D %h:%m:%s.%x sqlday ==> %Y-%M-%D dash ==> %Y-%M-%D sqltime ==> %h:%m:%s.%x rfc-2822 ==> %w, %D %l %Y %h:%m:%s %T rfc-3339 ==> %Y-%M-%DT%h:%m:%s%z date ==> %w %l %D %h:%m:%s UTC%z %Y short ==> %w, %l %d, %Y %H:%m:%s %N UTC%z long," " ==> %W, %L %d, %Y %H:%m:%s %N UTC%z suffix ==> %Y%D%M%h%m%s formal ==> The %d of %L %Y lord ==> the %d day of %L in the year of our Lord %Y easter ==> FOR THE YEAR OF THE CURRENT DATE: Easter day: the %d day of %L in the year of our Lord %Y all ==> A SAMPLE OF DATE FORMATS usage|help|? ==> %?Examples of single keywords
iso-8601 iso : 2024-06-29T08:56:48-04:00 iso-8601W isoweek : 2024-W26-6 sql : "2024-06-29 08:56:48.750" sqlday : "2024-06-29" dash : 2024-06-29 sqltime : 08:56:48.833 rfc-2822 : Sat, 29 Jun 2024 08:56:48 -0400 rfc-3339 : 2024-06-29T08:56:48-04:00 date : Sat Jun 29 08:56:48 UTC-04:00 2024 short : Sat, Jun 29th, 2024 8:56:48 AM UTC-04:00 long : Saturday, June 29th, 2024 8:56:48 AM UTC-04:00 suffix : 20242906085648 formal : The 29th of June 2024 lord : the 29th day of June in the year of our Lord 2024 easter : Easter day: the 31st day of March in the year of our Lord 2024 all : Civil Calendar: Saturday June 29th Civil Date: 2024-06-29 08:56:49 -04:00 Julian Date: 2460491.0394568751 Unix Epoch Time: 1719665809.0740056 Day Of Year: 181 ISO-8601 week: 2024-W26-6otherwise the following words are replaced with the most common macros:
numeric values:
year %Y 2016 month %M 07 day %D 29 hour %h 10 minute %m 54 second %s 08 timezone %T 0400
epoch %e 1469804049 julian %j 2457599 ordinal %O 211 weekday %u 5 age %A 13238944.3030
string values:
longmonth|MONTH %L July shortmonth|Month|Mth %l Jul longweekday|WEEKDAY %W Thursday shortweekday|Weekday|wkday %w Thu shortday|DAY %d 7th longday %X seventh TIMEZONE %z -04:00 Timezone %Z -240m GOOD %N AM goodhour|HOUR %H 10 AGE %a 1200-10:30:40
If none of these keywords are found then every letter that is a macro is assumed to have an implied percent in front of it. For example:
YMDhms ==> %Y%M%D%h%m%s ==> 20160729105408
John S. Urban, 2015-10-24
Nemo Release 3.1 | fmtdate_usage (3) | February 23, 2025 |