Generate and return the current or the requested date and time as an integer-valued array of size 8
or a formatted string.
More...
Generate and return the current or the requested date and time as an integer-valued array of size 8
or a formatted string.
This generic interface performs and exceeds the functionalities of the well-known strftime()
and strptime()
in the C family of programming languages.
- When no input argument is provided, the procedures under this generic interface return the current date and time as an
integer
vector of values
of size 8
, similar to the values
argument of the Fortran intrinsic procedure date_and_time()
.
- When the
format
argument is present, the procedures under this generic interface return the current date and time as a string with the specified format
.
- When any components of the date and time are specified as input argument,
- if
format
is missing, the procedures under this generic interface return the requested date and time as an integer
vector of values
of size 8
whose elements are set to the corresponding specified arguments and all other elements corresponding to the missing arguments are set to zero.
- if
format
is present, the procedures under this generic interface return the requested date and time as a formated string.
The following specifier are recognized in the input format
argument:
(Except where mentioned, the convensions are identical to those of the format
argument in the strftime()
function of the C/C++ programming languages)
(The specifiers marked with an asterisk (*) are locale-dependent in C/C++ but not currently in this library.)
Specifier | Example | Description |
\(\ms{%a}\) | Thu | Abbreviated weekday name * |
\(\ms{%A}\) | Thursday | Full weekday name * |
\(\ms{%b}\) | Aug | Abbreviated month name * |
\(\ms{%B}\) | August | Full month name * |
\(\ms{%c}\) | Thu Aug 23 14:55:02 2001 | Date and time representation * |
\(\ms{%C}\) | 20 | Year divided by 100 and floored to integer (-2,147,483,647 to +2,147,483,647) (extends the C/C++ strftime behavior) |
\(\ms{%d}\) | 23 | Day of the month, zero-padded (01-31) |
\(\ms{%D}\) | 08/23/01 | Short MM/DD/YY date, equivalent to \(\ms{%m/%d/%y}\) |
\(\ms{%e}\) | 23 | Day of the month, space-padded ( 1-31) |
\(\ms{%F}\) | 2001-08-23 | Short YYYY-MM-DD date, equivalent to \(\ms{%Y-%m-%d}\) |
\(\ms{%f}\) | 037 | The millisecond padded with leading zeros (unique to this library, follows the convension of Python for microsecond). |
\(\ms{%g}\) | 01 | Week-based year, last two digits (00-99) |
\(\ms{%G}\) | 2001 | Week-based year |
\(\ms{%h}\) | Aug | Abbreviated month name * (same as \(\ms{%b}\)) |
\(\ms{%H}\) | 14 | Hour in 24h format (00-23) |
\(\ms{%I}\) | 02 | Hour in 12h format (01-12) |
\(\ms{%j}\) | 235 | Day of the year (001-366) |
\(\ms{%m}\) | 08 | Month as a decimal number (01-12) |
\(\ms{%M}\) | 55 | Minute (00-59) |
\(\ms{%n}\) | \(\ms{\n}\) | New-line character |
\(\ms{%p}\) | PM | AM or PM designation |
\(\ms{%r}\) | 02:55:02 pm | 12-hour clock time * |
\(\ms{%R}\) | 14:55 | 24-hour HH:MM time, equivalent to \(\ms{%H:%M}\) |
\(\ms{%S}\) | 02 | Second (00-59) |
\(\ms{%t}\) | \(\ms{\t}\) | Horizontal-tab character |
\(\ms{%T}\) | 14:55:02 | ISO 8601 time format (HH:MM:SS ), equivalent to \(\ms{%H:%M:%S}\) |
\(\ms{%u}\) | 4 | ISO 8601 weekday as number with Monday as 1 (1-7) |
\(\ms{%U}\) | 33 | Week number with the first Sunday as the first day of week one (00-53) (currently not implemented) |
\(\ms{%V}\) | 34 | ISO 8601 week number (01-53) |
\(\ms{%w}\) | 4 | Weekday as a decimal number with Sunday as 0 (0-6) |
\(\ms{%W}\) | 34 | Week number with the first Monday as the first day of week one (00-53) (currently not implemented) |
\(\ms{%x}\) | 08/23/01 | Date representation * |
\(\ms{%X}\) | 14:55:02 | Time representation * |
\(\ms{%y}\) | 01 | Year, last two digits (00-99) |
\(\ms{%Y}\) | 2001 | Year |
\(\ms{%z}\) | +0100 | ISO 8601 offset from UTC in time zone in units of minutes (as returned by the Fortran intrinsic date_and_time() ). |
\(\ms{%Z}\) | CDT | Time zone abbreviation (daylight saving not implemented; different from the C/C++ strftime behavior which uses system time zone name) |
\(\ms{%%}\) | % | A % sign |
- Parameters
-
[in] | format | : The input scalar or array of the same shape as other array-like arguments of type character of default kind SK, containing the output format of the specified date and time (See the table above for a list of possible specifiers). (optional. If missing, the output date and time will be an integer vector of size 8 .) |
[in] | julianDay | : The input scalar of type real of default kind RK, containing the Julian Day to be converted to the corresponding Gregorian date and time.
(optional, default = it can be present only if all arguments are missing or if only format and/or zone are present.) |
[in] | year | : The input scalar of type integer of default kind IK, containing the year of the Gregorian calendar.
(optional, default = the current value if all arguments are missing or only format is present.) |
[in] | month | : The input scalar of type integer of default kind IK, containing the month of the year of the Gregorian calendar.
(optional, default = 1 or the current value if all arguments are missing or only format is present. It can be present only if year is present.) |
[in] | day | : The input scalar of type integer of default kind IK, containing the day of the month of the year of the Gregorian calendar.
(optional, default = 1 or the current value if all arguments are missing or only format is present. It can be present only if month is present.) |
[in] | zone | : The input scalar of type integer of default kind IK, containing the time zone of the Gregorian calendar in minutes.
(optional, default = 0 (UTC) or the current value if all arguments are missing or only format is present. It can be present only if either day or julianDay (but noth both) is present.) |
[in] | hour | : The input scalar of type integer of default kind IK, containing the hour of the day of the Gregorian calendar.
(optional, default = 0 or the current value if all arguments are missing or only format is present. It can be present only if zone is present.) |
[in] | minute | : The input scalar of type integer of default kind IK, containing the minute of the hour of the day of the Gregorian calendar.
(optional, default = 0 or the current value if all arguments are missing or only format is present. It can be present only if hour is present.) |
[in] | second | : The input scalar of type integer of default kind IK, containing the second of the minute of the hour of the day of the Gregorian calendar.
(optional, default = 0 or the current value if all arguments are missing or only format is present. It can be present only if minute is present.) |
[in] | millisecond | : The input scalar of type integer of default kind IK, containing the millisecond of the second of the minute of the hour of the day of the Gregorian calendar.
(optional, default = 0 or the current value if all arguments are missing or only format is present. It can be present only if second is present.) |
[in] | values | : The input contiguous vector of maximum size 8 of type integer of default kind IK, containing the values [year, month, day, zone, hour, minute, seconds, milliseconds] of the Gregorian calendar.
The order of the elements of the vector follows that of the values returned by the Fortran intrinsic date_and_time() .
(optional, default = the current date and time. It can be present only if format is also present and all other arguments are missing.) |
- Returns
string / values(1:8)
: If the input argument format
is present, the output is a scalar formatted string containing the requested date and time.
If the input argument format
is missing, the output is a vector of size 8
of type integer
of default kind IK containing the requested date and time of the Gregorian Calendar.
Possible calling interfaces ⛓
character(:, SK), allocatable :: string
integer(IK) :: values(8)
values(
1:
8)
= getDateTime(year, month, day, zone, hour)
values(
1:
8)
= getDateTime(year, month, day, zone, hour, minute)
values(
1:
8)
= getDateTime(year, month, day, zone, hour, minute, second)
values(
1:
8)
= getDateTime(year, month, day, zone, hour, minute, second, millisecond)
!
Generate and return the current or the requested date and time as an integer-valued array of size 8 o...
This module contains classes and procedures for computing, manipulating, and styling dates and times.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
- Warning
- The condition
0 < size(values)
must hold for the corresponding input arguments.
The condition 9 > size(values)
must hold for the corresponding input arguments.
The specified number of elements of values
, if less than 8
, must be consistent with the specifiers in input format
.
For example, when \(\ms{%Z}\) is specified together with values
, then the size of values
must be at least 4
.
An input argument year = 0
corresponds to the historic 1 BC notation of the Gregorian calendar.
This is in accordance with the convention in astronomical year numbering and the international standard date system, ISO 8601.
The input month
must be a number between 1
and 12
.
The input day
must be a number between 1
and 31
and be consistent with the specified month and (leap) year.
The input zone
must be a valid time zone in units of minutes.
The input hour
must be a number between 0
and 23
.
The input minute
must be a number between 0
and 59
.
The input second
must be a number between 0
and 59
.
The input millisecond
must be a number between 0
and 999
.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1
.
-
The
pure
procedure(s) documented herein become impure
when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1
.
By default, these procedures are pure
in release
build and impure
in debug
and testing
builds.
- See also
- getMillisecond
getSecond
getMinute
getHour12
getHour
getZone
getZoneAbbr
getDay
getMonth
getYear
isLeapYear
getJulianDay
getDateTimeNewZone
Example usage ⛓
9 integer(IK) :: Values(
8)
11 type(display_type) :: disp
15 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
16 call disp%show(
"! Generate and return the current local Gregorian date and time.")
17 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
26 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
27 call disp%show(
"! Generate and return the specified Gregorian date and time as vector.")
28 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
32 call disp%show(
"getDateTime(2000_IK)")
34 call disp%show(
"getDateTime(2000_IK, 12_IK)")
36 call disp%show(
"getDateTime(2000_IK, 12_IK, 13_IK)")
38 call disp%show(
"getDateTime(2000_IK, 12_IK, 13_IK, -420_IK)")
40 call disp%show(
"getDateTime(2000_IK, 12_IK, 13_IK, -420_IK, 18)")
42 call disp%show(
"getDateTime(2000_IK, 12_IK, 13_IK, -420_IK, 18, 21)")
44 call disp%show(
"getDateTime(2000_IK, 12_IK, 13_IK, -420_IK, 18, 21, 35)")
46 call disp%show(
"getDateTime(2000_IK, 12_IK, 13_IK, -420_IK, 18, 21, 35, 847)")
51 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
52 call disp%show(
"! Generate and return the UTC Gregorian date and time as a vector corresponding to the input Julian day.")
53 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
56 call disp%show(
"getDateTime(1720694.5_RK) ! January 1, -1, (2 BC) start of day.")
59 call disp%show(
"getDateTime(1720694.5_RK + 365._RK) ! January 1, -1, (1 BC) start of day.")
62 call disp%show(
"getDateTime(1720694.5_RK + 365._RK + 366._RK) ! January 1, 1, (AD 1) start of day.")
65 call disp%show(
"getDateTime(2299160.5_RK) ! October 15, 1582, start of day (first day of Gregorian reform).")
68 call disp%show(
"getDateTime(2415385.5_RK) ! January 1, 1901, start of day (start of the 20th century).")
71 call disp%show(
"getDateTime(2440587.5_RK) ! January 1, 1970, start of day (Unix reference date).")
74 call disp%show(
"getDateTime(2444239.5_RK) ! January 1, 1980, start of day (Unix reference date).")
77 call disp%show(
"getDateTime(2444240.0_RK) ! January 1, 1980, noon (Unix reference date).")
80 call disp%show(
"getDateTime(2451545.25_RK) ! January 1, 2000, 18:00 UTC.")
84 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
85 call disp%show(
"! Generate and return the Gregorian date and time as a string.")
86 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
95 call disp%show(
"getDateTime(SK_'Today is %A.')")
100 call disp%show(
"getDateTime(SK_'%A is abbreviated as %a.')")
105 call disp%show(
"getDateTime(SK_'Today is a %A of month %B.')")
110 call disp%show(
"getDateTime(SK_'%B is abbreviated as %b.')")
115 call disp%show(
"getDateTime(SK_'Current Date and Time is %c')")
120 call disp%show(
"getDateTime(SK_'The Julian Period starts at %c of the Gregorian Calendar.', getDateTime(-4713_IK, 1_IK, 1_IK, 0_IK, 12_IK))")
121 call disp%show(
getDateTime(SK_
'The Julian Period starts at %c of the Gregorian Calendar.',
getDateTime(
-4713_IK,
1_IK,
1_IK,
0_IK,
12_IK)) , deliml
= SK_
"""" )
125 call disp%show(
"getDateTime(SK_'The last century was %C.')")
130 call disp%show(
"getDateTime(SK_'The last century BC was %C.', getDateTime(year = -1_IK))")
135 call disp%show(
"getDateTime(SK_'The Holocene geological epoch roughly began at century %C.', getDateTime(year = -12000_IK))")
140 call disp%show(
"getDateTime(SK_'The current day of month is %d.')")
145 call disp%show(
"getDateTime(SK_'The first day of every month (zero-padded) is %d.', getDateTime(0_IK))")
149 call disp%show(
"getDateTime(SK_'The first day of every month (blank-padded) is %e.', getDateTime(0_IK))")
154 call disp%show(
"getDateTime(SK_'March 21, 1987 in short (slashed) format is %D.', getDateTime(1987_IK, 3_IK, 21_IK))")
159 call disp%show(
"getDateTime(SK_'The millisecond of the moment now (possibly padded with leading zeros) %f.')")
160 call disp%show(
getDateTime(SK_
'The millisecond of the moment now (possibly padded with leading zeros) %f.') , deliml
= SK_
"""" )
164 call disp%show(
"getDateTime(SK_'March 21, 1987 in short (dashed) format is %F.', getDateTime(-1987_IK, 3_IK, 21_IK))")
169 call disp%show(
"getDateTime(SK_'The last two digits of the week year of the Gregorian Calendar date 1 Jan 1977 are %g.', getDateTime(1977_IK, 1_IK, 1_IK))")
170 call disp%show(
getDateTime(SK_
'The last two digits of the week year of the Gregorian Calendar date 1 Jan 1977 are %g.',
getDateTime(
1977_IK,
1_IK,
1_IK)) , deliml
= SK_
"""" )
174 call disp%show(
"getDateTime(SK_'The full week year of the Gregorian Calendar date 1 Jan 1977 is %G.', getDateTime(1977_IK, 1_IK, 1_IK))")
175 call disp%show(
getDateTime(SK_
'The full week year of the Gregorian Calendar date 1 Jan 1977 is %G.',
getDateTime(
1977_IK,
1_IK,
1_IK)) , deliml
= SK_
"""" )
179 call disp%show(
"getDateTime(SK_'The locale abbreviation for month %B is %h.')")
180 call disp%show(
getDateTime(SK_
'The locale abbreviation for month %B is %h.') , deliml
= SK_
"""" )
184 call disp%show(
"getDateTime(SK_'The hour 6 pm in 24-hour format is %H.', getDateTime(1_IK, 1_IK, 1_IK, 0_IK, 18_IK))")
189 call disp%show(
"getDateTime(SK_'The hour 6 pm in 12-hour format is %I.', getDateTime(1_IK, 1_IK, 1_IK, 0_IK, 18_IK))")
194 call disp%show(
"getDateTime(SK_'The current day of year (ordinal day) is %j.')")
195 call disp%show(
getDateTime(SK_
'The current day of year (ordinal day) is %j.') , deliml
= SK_
"""" )
199 call disp%show(
"getDateTime(SK_'The day of year (ordinal day) corresponding to March 21, 1987 is %j.', getDateTime(1987_IK, 3_IK, 21_IK))")
200 call disp%show(
getDateTime(SK_
'The day of year (ordinal day) corresponding to March 21, 1987 is %j.',
getDateTime(
1987_IK,
3_IK,
21_IK)) , deliml
= SK_
"""" )
204 call disp%show(
"getDateTime(SK_'The month of March 21, 1987 as a decimal number is %m.', getDateTime(1987_IK, 3_IK, 21_IK))")
209 call disp%show(
"getDateTime(SK_'The current minute of time is %M.')")
214 call disp%show(
"getDateTime(SK_'The specifier %%n yields a new line character: %n.')")
215 call disp%show(
getDateTime(SK_
'The specifier %%n yields a new line character: %n.') , deliml
= SK_
"""" )
219 call disp%show(
"getDateTime(SK_'The current moment is in %p period of day.')")
220 call disp%show(
getDateTime(SK_
'The current moment is in %p period of day.') , deliml
= SK_
"""" )
224 call disp%show(
"getDateTime(SK_'The current 12-hour clock time is %r.')")
225 call disp%show(
getDateTime(SK_
'The current 12-hour clock time is %r.') , deliml
= SK_
"""" )
229 call disp%show(
"getDateTime(SK_'The current 24-hour clock time is %r.')")
230 call disp%show(
getDateTime(SK_
'The current 24-hour clock time is %r.') , deliml
= SK_
"""" )
234 call disp%show(
"getDateTime(SK_'The initial hour and minute setting of the Doomsday Clock was %R.', getDateTime(1947, 1_IK, 1_IK, 0_IK, 23_IK, 53_IK))")
235 call disp%show(
getDateTime(SK_
'The initial hour and minute setting of the Doomsday Clock was %R.',
getDateTime(
1947,
1_IK,
1_IK,
0_IK,
23_IK,
53_IK)) , deliml
= SK_
"""" )
239 call disp%show(
"getDateTime(SK_'The second of the moment now is %S.')")
244 call disp%show(
"getDateTime(SK_'The specifier %%t yields a horizontal tab character: %t.')")
245 call disp%show(
getDateTime(SK_
'The specifier %%t yields a horizontal tab character: %t.') , deliml
= SK_
"""" )
249 call disp%show(
"getDateTime(SK_'The current local time in ISO 8601 format is %T.')")
250 call disp%show(
getDateTime(SK_
'The current local time in ISO 8601 format is %T.') , deliml
= SK_
"""" )
254 call disp%show(
"getDateTime(SK_'The current ISO 8601 weekday is %u.')")
259 call disp%show(
"getDateTime(SK_'The current ISO 8601 week number is %V.')")
260 call disp%show(
getDateTime(SK_
'The current ISO 8601 week number is %V.') , deliml
= SK_
"""" )
264 call disp%show(
"getDateTime(SK_'The current weekday as a decimal number with Sunday as 0 is %w.')")
265 call disp%show(
getDateTime(SK_
'The current weekday as a decimal number with Sunday as 0 is %w.') , deliml
= SK_
"""" )
269 call disp%show(
"getDateTime(SK_'March 21, 1987 in locale format is %x.', getDateTime(1987_IK, 3_IK, 21_IK))")
274 call disp%show(
"getDateTime(SK_'The current time in locale format is %X.')")
275 call disp%show(
getDateTime(SK_
'The current time in locale format is %X.') , deliml
= SK_
"""" )
279 call disp%show(
"getDateTime(SK_'The last two digits of the current year are %y.')")
280 call disp%show(
getDateTime(SK_
'The last two digits of the current year are %y.') , deliml
= SK_
"""" )
284 call disp%show(
"getDateTime(SK_'The last two digits of year 1987 are %y.', getDateTime(1987_IK))")
289 call disp%show(
"getDateTime(SK_'The current local ISO 8601 offset from UTC in timezone in units of minutes is %z.')")
290 call disp%show(
getDateTime(SK_
'The current local ISO 8601 offset from UTC in timezone in units of minutes is %z.') , deliml
= SK_
"""" )
294 call disp%show(
"getDateTime(SK_'The current local timezone abbreviation is %Z.')")
295 call disp%show(
getDateTime(SK_
'The current local timezone abbreviation is %Z.') , deliml
= SK_
"""" )
299 call disp%show(
"getDateTime(SK_'The timezone abbreviations corresponding to ISO timezone UTC-12 is %Z.', getDateTime(1_IK, 1_IK, 1_IK, -12_IK * 60_IK))")
300 call disp%show(
getDateTime(SK_
'The timezone abbreviations corresponding to ISO timezone UTC-12 is %Z.',
getDateTime(
1_IK,
1_IK,
1_IK,
-12_IK * 60_IK)) , deliml
= SK_
"""" )
304 call disp%show(
"getDateTime(SK_'The timezone abbreviations corresponding to ISO timezone UTC-11 is %Z.', getDateTime(1_IK, 1_IK, 1_IK, -11_IK * 60_IK))")
305 call disp%show(
getDateTime(SK_
'The timezone abbreviations corresponding to ISO timezone UTC-11 is %Z.',
getDateTime(
1_IK,
1_IK,
1_IK,
-11_IK * 60_IK)) , deliml
= SK_
"""" )
309 call disp%show(
"getDateTime(SK_'The timezone abbreviations corresponding to ISO timezone UTC-10 is %Z.', getDateTime(1_IK, 1_IK, 1_IK, -10_IK * 60_IK))")
310 call disp%show(
getDateTime(SK_
'The timezone abbreviations corresponding to ISO timezone UTC-10 is %Z.',
getDateTime(
1_IK,
1_IK,
1_IK,
-10_IK * 60_IK)) , deliml
= SK_
"""" )
314 call disp%show(
"getDateTime(SK_'The timezone abbreviations corresponding to ISO timezone UTC-9:30 is %Z.', getDateTime(1_IK, 1_IK, 1_IK, -9_IK * 60_IK - 30_IK))")
315 call disp%show(
getDateTime(SK_
'The timezone abbreviations corresponding to ISO timezone UTC-9:30 is %Z.',
getDateTime(
1_IK,
1_IK,
1_IK,
-9_IK * 60_IK - 30_IK)) , deliml
= SK_
"""" )
319 call disp%show(
"getDateTime(SK_'The timezone abbreviations corresponding to ISO timezone UTC-9 is %Z.', getDateTime(1_IK, 1_IK, 1_IK, -9_IK * 60_IK))")
320 call disp%show(
getDateTime(SK_
'The timezone abbreviations corresponding to ISO timezone UTC-9 is %Z.',
getDateTime(
1_IK,
1_IK,
1_IK,
-9_IK * 60_IK)) , deliml
= SK_
"""" )
324 call disp%show(
"getDateTime(SK_'The timezone abbreviations corresponding to ISO timezone UTC-8:30 is %Z.', getDateTime(1_IK, 1_IK, 1_IK, -8_IK * 60_IK - 30_IK)) ! non-existent timezone yields empty abbreviation.")
325 call disp%show(
getDateTime(SK_
'The timezone abbreviations corresponding to ISO timezone UTC-8:30 is %Z.',
getDateTime(
1_IK,
1_IK,
1_IK,
-8_IK * 60_IK - 30_IK)) , deliml
= SK_
"""" )
329 call disp%show(
"getDateTime(SK_'The timezone abbreviations corresponding to ISO timezone UTC+0 is %Z.', getDateTime(1_IK, 1_IK, 1_IK, +0_IK * 60_IK))")
330 call disp%show(
getDateTime(SK_
'The timezone abbreviations corresponding to ISO timezone UTC+0 is %Z.',
getDateTime(
1_IK,
1_IK,
1_IK,
+0_IK * 60_IK)) , deliml
= SK_
"""" )
334 call disp%show(
"getDateTime(SK_'The timezone abbreviations corresponding to ISO timezone UTC+8 is %Z.', getDateTime(1_IK, 1_IK, 1_IK, +8_IK * 60_IK))")
335 call disp%show(
getDateTime(SK_
'The timezone abbreviations corresponding to ISO timezone UTC+8 is %Z.',
getDateTime(
1_IK,
1_IK,
1_IK,
+8_IK * 60_IK)) , deliml
= SK_
"""" )
339 call disp%show(
"getDateTime(SK_'The current year is %Y.')")
344 call disp%show(
"getDateTime(SK_'%Q : An undefined specifier has no effects.')")
345 call disp%show(
getDateTime(SK_
'%Q : An undefined specifier has no effects.') , deliml
= SK_
"""" )
349 call disp%show(
"getDateTime(SK_'%%A : two sequential percentage characters translate to a single percentage character.')")
350 call disp%show(
getDateTime(SK_
'%%A : two sequential percentage characters translate to a single percentage character.') , deliml
= SK_
"""" )
354 call disp%show(
"getDateTime(SK_'% : dangling percentage character does nothing.')")
355 call disp%show(
getDateTime(SK_
'% : dangling percentage character does nothing.') , deliml
= SK_
"""" )
This is a generic method of the derived type display_type with pass attribute.
This is a generic method of the derived type display_type with pass attribute.
This module contains classes and procedures for input/output (IO) or generic display operations on st...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
Generate and return an object of type display_type.
Example Unix compile command via Intel ifort
compiler ⛓
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example Windows Batch compile command via Intel ifort
compiler ⛓
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
Example Unix / MinGW compile command via GNU gfortran
compiler ⛓
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example output ⛓
8+2024,
+11,
+14,
-360,
+22,
+14,
+15,
+124
17+2000,
+1,
+1,
+0,
+0,
+0,
+0,
+0
19+2000,
+12,
+1,
+0,
+0,
+0,
+0,
+0
21+2000,
+12,
+13,
+0,
+0,
+0,
+0,
+0
23+2000,
+12,
+13,
-420,
+0,
+0,
+0,
+0
25+2000,
+12,
+13,
-420,
+18,
+0,
+0,
+0
27+2000,
+12,
+13,
-420,
+18,
+21,
+0,
+0
28getDateTime(
2000_IK,
12_IK,
13_IK,
-420_IK,
18,
21,
35)
29+2000,
+12,
+13,
-420,
+18,
+21,
+35,
+0
30getDateTime(
2000_IK,
12_IK,
13_IK,
-420_IK,
18,
21,
35,
847)
31+2000,
+12,
+13,
-420,
+18,
+21,
+35,
+847
39-1,
+1,
+1,
+0,
+0,
+0,
+0,
+0
41+0,
+1,
+1,
+0,
+0,
+0,
+0,
+0
43+1,
+1,
+1,
+0,
+0,
+0,
+0,
+0
45+1582,
+10,
+15,
+0,
+0,
+0,
+0,
+0
47+1901,
+1,
+1,
+0,
+0,
+0,
+0,
+0
49+1970,
+1,
+1,
+0,
+0,
+0,
+0,
+0
51+1980,
+1,
+1,
+0,
+0,
+0,
+0,
+0
53+1980,
+1,
+1,
+0,
+12,
+0,
+0,
+0
55+2000,
+1,
+1,
+0,
+18,
+0,
+0,
+0
71"Thursday is abbreviated as Thu."
75"Today is a Thursday of month November."
79"November is abbreviated as Nov."
83"Current Date and Time is Thu Nov 14 22:14:15 2024"
86getDateTime(SK_
'The Julian Period starts at %c of the Gregorian Calendar.',
getDateTime(
-4713_IK,
1_IK,
1_IK,
0_IK,
12_IK))
87"The Julian Period starts at Wed Jan 01 12:00:00 -4713 of the Gregorian Calendar."
91"The last century was +20."
95"The last century BC was -01."
99"The Holocene geological epoch roughly began at century -120."
103"The current day of month is 14."
107"The first day of every month (zero-padded) is 01."
111"The first day of every month (blank-padded) is 1."
115"March 21, 1987 in short (slashed) format is 03/21/87."
118getDateTime(SK_
'The millisecond of the moment now (possibly padded with leading zeros) %f.')
119"The millisecond of the moment now (possibly padded with leading zeros) 124."
123"March 21, 1987 in short (dashed) format is -1987-03-21."
126getDateTime(SK_
'The last two digits of the week year of the Gregorian Calendar date 1 Jan 1977 are %g.',
getDateTime(
1977_IK,
1_IK,
1_IK))
127"The last two digits of the week year of the Gregorian Calendar date 1 Jan 1977 are 76."
130getDateTime(SK_
'The full week year of the Gregorian Calendar date 1 Jan 1977 is %G.',
getDateTime(
1977_IK,
1_IK,
1_IK))
131"The full week year of the Gregorian Calendar date 1 Jan 1977 is 1976."
134getDateTime(SK_
'The locale abbreviation for month %B is %h.')
135"The locale abbreviation for month November is Nov."
139"The hour 6 pm in 24-hour format is 18."
143"The hour 6 pm in 12-hour format is 06."
146getDateTime(SK_
'The current day of year (ordinal day) is %j.')
147"The current day of year (ordinal day) is 319."
150getDateTime(SK_
'The day of year (ordinal day) corresponding to March 21, 1987 is %j.',
getDateTime(
1987_IK,
3_IK,
21_IK))
151"The day of year (ordinal day) corresponding to March 21, 1987 is 080."
154getDateTime(SK_
'The month of March 21, 1987 as a decimal number is %m.',
getDateTime(
1987_IK,
3_IK,
21_IK))
155"The month of March 21, 1987 as a decimal number is 03."
159"The current minute of time is 14."
162getDateTime(SK_
'The specifier %%n yields a new line character: %n.')
163"The specifier %n yields a new line character:
167getDateTime(SK_
'The current moment is in %p period of day.')
168"The current moment is in PM period of day."
171getDateTime(SK_
'The current 12-hour clock time is %r.')
172"The current 12-hour clock time is 10:14:15 pm."
175getDateTime(SK_
'The current 24-hour clock time is %r.')
176"The current 24-hour clock time is 10:14:15 pm."
179getDateTime(SK_
'The initial hour and minute setting of the Doomsday Clock was %R.',
getDateTime(
1947,
1_IK,
1_IK,
0_IK,
23_IK,
53_IK))
180"The initial hour and minute setting of the Doomsday Clock was 23:53."
183getDateTime(SK_
'The second of the moment now is %S.')
184"The second of the moment now is 15."
187getDateTime(SK_
'The specifier %%t yields a horizontal tab character: %t.')
188"The specifier %t yields a horizontal tab character: ."
191getDateTime(SK_
'The current local time in ISO 8601 format is %T.')
192"The current local time in ISO 8601 format is 22:14:15."
195getDateTime(SK_
'The current ISO 8601 weekday is %u.')
196"The current ISO 8601 weekday is 4."
199getDateTime(SK_
'The current ISO 8601 week number is %V.')
200"The current ISO 8601 week number is 46."
203getDateTime(SK_
'The current weekday as a decimal number with Sunday as 0 is %w.')
204"The current weekday as a decimal number with Sunday as 0 is 4."
208"March 21, 1987 in locale format is 03/21/87."
211getDateTime(SK_
'The current time in locale format is %X.')
212"The current time in locale format is 22:14:15."
215getDateTime(SK_
'The last two digits of the current year are %y.')
216"The last two digits of the current year are 24."
220"The last two digits of year 1987 are 87."
223getDateTime(SK_
'The current local ISO 8601 offset from UTC in timezone in units of minutes is %z.')
224"The current local ISO 8601 offset from UTC in timezone in units of minutes is -0360."
227getDateTime(SK_
'The current local timezone abbreviation is %Z.')
228"The current local timezone abbreviation is CST."
231getDateTime(SK_
'The timezone abbreviations corresponding to ISO timezone UTC-12 is %Z.',
getDateTime(
1_IK,
1_IK,
1_IK,
-12_IK * 60_IK))
232"The timezone abbreviations corresponding to ISO timezone UTC-12 is IDLW."
235getDateTime(SK_
'The timezone abbreviations corresponding to ISO timezone UTC-11 is %Z.',
getDateTime(
1_IK,
1_IK,
1_IK,
-11_IK * 60_IK))
236"The timezone abbreviations corresponding to ISO timezone UTC-11 is SST."
239getDateTime(SK_
'The timezone abbreviations corresponding to ISO timezone UTC-10 is %Z.',
getDateTime(
1_IK,
1_IK,
1_IK,
-10_IK * 60_IK))
240"The timezone abbreviations corresponding to ISO timezone UTC-10 is HST."
243getDateTime(SK_
'The timezone abbreviations corresponding to ISO timezone UTC-9:30 is %Z.',
getDateTime(
1_IK,
1_IK,
1_IK,
-9_IK * 60_IK - 30_IK))
244"The timezone abbreviations corresponding to ISO timezone UTC-9:30 is MIT."
247getDateTime(SK_
'The timezone abbreviations corresponding to ISO timezone UTC-9 is %Z.',
getDateTime(
1_IK,
1_IK,
1_IK,
-9_IK * 60_IK))
248"The timezone abbreviations corresponding to ISO timezone UTC-9 is AKST."
251getDateTime(SK_
'The timezone abbreviations corresponding to ISO timezone UTC-8:30 is %Z.',
getDateTime(
1_IK,
1_IK,
1_IK,
-8_IK * 60_IK - 30_IK))
252"The timezone abbreviations corresponding to ISO timezone UTC-8:30 is AKST."
255getDateTime(SK_
'The timezone abbreviations corresponding to ISO timezone UTC+0 is %Z.',
getDateTime(
1_IK,
1_IK,
1_IK,
+0_IK * 60_IK))
256"The timezone abbreviations corresponding to ISO timezone UTC+0 is UTC."
259getDateTime(SK_
'The timezone abbreviations corresponding to ISO timezone UTC+8 is %Z.',
getDateTime(
1_IK,
1_IK,
1_IK,
+8_IK * 60_IK))
260"The timezone abbreviations corresponding to ISO timezone UTC+8 is SST."
264"The current year is 2024."
267getDateTime(SK_
'%Q : An undefined specifier has no effects.')
268"%Q : An undefined specifier has no effects."
271getDateTime(SK_
'%%A : two sequential percentage characters translate to a single percentage character.')
272"%A : two sequential percentage characters translate to a single percentage character."
275getDateTime(SK_
'% : dangling percentage character does nothing.')
276"% : dangling percentage character does nothing."
- Test:
- test_pm_dateTime
- Todo:
- Low Priority: Locale-dependent date and time formats can be added to this generic interface in the future, depending on the demand.
- Todo:
- Normal Priority: This interface can be extended to add
format
input argument to all possible calling interfaces.
- Todo:
- High Priority: The format specifiers \(\ms{%U}\) and \(\ms{%W}\) must be implemented.
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
-
If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
-
If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
- Copyright
- Computational Data Science Lab
- Author:
- Amir Shahmoradi, March 22, 2012, 00:00 AM, National Institute for Fusion Studies, The University of Texas Austin
Definition at line 2367 of file pm_dateTime.F90.