ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_dateTime::getDateTimeUTC Interface Reference

Generate and return the current or the requested date and time converted to the corresponding Coordinated Universal Time (UTC) as an integer-valued array of size 8. More...

Detailed Description

Generate and return the current or the requested date and time converted to the corresponding Coordinated Universal Time (UTC) as an integer-valued array of size 8.

The first four input arguments or the first four elements of the input vector values(:) are mandatory and must be provided since they determine the date and local time zone of interest.
The rest of the elements containing the time of the day of the Gregorian Calendar are optional and taken to be zero if not provided.

Parameters
[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 input arguments are missing. It can be present if only if month, day, and zone are also present and values is missing.)
[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 input arguments are missing). It must be present if year is also 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 input arguments are missing). It must be present if month is also present.)
[in]zone: The input scalar of type integer of default kind IK, containing the local time zone of the Gregorian calendar in minutes.
(optional, default = 0 (UTC) (or the current value if all input arguments are missing). It must be present if day is also 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 input arguments are missing). 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 input arguments are missing). 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 input arguments are missing). 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 input arguments are missing). It can be present only if second is present.)
[in]values: The input contiguous vector of minimum size 4 and 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 or a subset of the octuple starting with year.
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 all other arguments are missing.)
Returns
DateTimeUTC(1:8) : The output vector of size 8 of type integer of default kind IK containing the requested UTC date and time of the Gregorian Calendar corresponding to the input local date and time in the order [year, month, day, zone, hour, minute, seconds, milliseconds]. By definition, DateTimeUTC(4) (corresponding to the UTC time zone) is always zero.


Possible calling interfaces

use pm_kind, only: SK, IK
integer(IK) :: DateTimeUTC(8)
integer(IK) :: DateTime(8)
DateTimeUTC(1:8) = getDateTimeUTC() ! return the current UTC date and time.
DateTimeUTC(1:8) = getDateTimeUTC(year, month, day, zone)
DateTimeUTC(1:8) = getDateTimeUTC(year, month, day, zone, hour)
DateTimeUTC(1:8) = getDateTimeUTC(year, month, day, zone, hour, minute)
DateTimeUTC(1:8) = getDateTimeUTC(year, month, day, zone, hour, minute, second)
DateTimeUTC(1:8) = getDateTimeUTC(year, month, day, zone, hour, minute, second, millisecond)
DateTimeUTC(1:8) = getDateTimeUTC(DateTime(1:8)) ! DateTime(1:8) = [year, month, day, zone, hour, minute, second, millisecond]
DateTimeUTC(1:8) = getDateTimeUTC(DateTime(1:7)) ! DateTime(1:7) = [year, month, day, zone, hour, minute, second]
DateTimeUTC(1:8) = getDateTimeUTC(DateTime(1:6)) ! DateTime(1:6) = [year, month, day, zone, hour, minute]
DateTimeUTC(1:8) = getDateTimeUTC(DateTime(1:5)) ! DateTime(1:5) = [year, month, day, zone, hour]
DateTimeUTC(1:8) = getDateTimeUTC(DateTime(1:4)) ! DateTime(1:4) = [year, month, day, zone]
!
Generate and return the current or the requested date and time converted to the corresponding Coordin...
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...
Definition: pm_kind.F90:268
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
Warning
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.
Remarks
The procedures under this generic interface are always impure when all input arguments are missing.
See also
getJulianDay
getDateTimeNewZone


Example usage

1program example
2
3 use pm_kind, only: SK, IK
4 use pm_io, only: display_type
5 use pm_dateTime, only: getDateTime
7
8 implicit none
9
10 type(display_type) :: disp
11 disp = display_type(file = "main.out.F90")
12
13 call disp%skip()
14 call disp%show("getDateTime()")
15 call disp%show( getDateTime() )
16 call disp%show("getDateTimeUTC()")
17 call disp%show( getDateTimeUTC() )
18 call disp%skip()
19
20 call disp%skip()
21 call disp%show("getDateTimeUTC(2000_IK, 12_IK, 31_IK, -660_IK)")
22 call disp%show( getDateTimeUTC(2000_IK, 12_IK, 31_IK, -660_IK) )
23
24 call disp%skip()
25 call disp%show("getDateTimeUTC(2000_IK, 12_IK, 31_IK, -660_IK, 18_IK)")
26 call disp%show( getDateTimeUTC(2000_IK, 12_IK, 31_IK, -660_IK, 18_IK) )
27
28 call disp%skip()
29 call disp%show("getDateTimeUTC(2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK)")
30 call disp%show( getDateTimeUTC(2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK) )
31
32 call disp%skip()
33 call disp%show("getDateTimeUTC(2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK, 35_IK)")
34 call disp%show( getDateTimeUTC(2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK, 35_IK) )
35
36 call disp%skip()
37 call disp%show("getDateTimeUTC(2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK, 35_IK, 847_IK)")
38 call disp%show( getDateTimeUTC(2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK, 35_IK, 847_IK) )
39
40 call disp%skip()
41 call disp%show("getDateTimeUTC(2000_IK, 2_IK, 29_IK, -660_IK, 18_IK, 21_IK, 35_IK, 847_IK)")
42 call disp%show( getDateTimeUTC(2000_IK, 2_IK, 29_IK, -660_IK, 18_IK, 21_IK, 35_IK, 847_IK) )
43
44 call disp%skip()
45 call disp%show("getDateTimeUTC(2000_IK, 3_IK, 1_IK, +660_IK, 8_IK, 21_IK, 35_IK, 847_IK)")
46 call disp%show( getDateTimeUTC(2000_IK, 3_IK, 1_IK, +660_IK, 8_IK, 21_IK, 35_IK, 847_IK) )
47
48 call disp%skip()
49 call disp%show("getDateTimeUTC(1999_IK, 3_IK, 1_IK, +660_IK, 8_IK, 21_IK, 35_IK, 847_IK)")
50 call disp%show( getDateTimeUTC(1999_IK, 3_IK, 1_IK, +660_IK, 8_IK, 21_IK, 35_IK, 847_IK) )
51
52 call disp%skip()
53 call disp%show("getDateTimeUTC(-1_IK, 12_IK, 31_IK, -660_IK, 20_IK)")
54 call disp%show( getDateTimeUTC(-1_IK, 12_IK, 31_IK, -660_IK, 20_IK) )
55
56 call disp%skip()
57 call disp%show("getDateTimeUTC(1_IK, 1_IK, 1_IK, +660_IK)")
58 call disp%show( getDateTimeUTC(1_IK, 1_IK, 1_IK, +660_IK) )
59
60end program example
Generate and return the current or the requested date and time as an integer-valued array of size 8 o...
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
3+2024, +10, +27, -300, +22, +32, +32, +892
5+2024, +10, +28, +0, +3, +32, +32, +892
6
7
8getDateTimeUTC(2000_IK, 12_IK, 31_IK, -660_IK)
9+2000, +12, +31, +0, +11, +0, +0, +0
10
11getDateTimeUTC(2000_IK, 12_IK, 31_IK, -660_IK, 18_IK)
12+2001, +1, +1, +0, +5, +0, +0, +0
13
14getDateTimeUTC(2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK)
15+2001, +1, +1, +0, +5, +21, +0, +0
16
17getDateTimeUTC(2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK, 35_IK)
18+2001, +1, +1, +0, +5, +21, +35, +0
19
20getDateTimeUTC(2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK, 35_IK, 847_IK)
21+2001, +1, +1, +0, +5, +21, +35, +847
22
23getDateTimeUTC(2000_IK, 2_IK, 29_IK, -660_IK, 18_IK, 21_IK, 35_IK, 847_IK)
24+2000, +3, +1, +0, +5, +21, +35, +847
25
26getDateTimeUTC(2000_IK, 3_IK, 1_IK, +660_IK, 8_IK, 21_IK, 35_IK, 847_IK)
27+2000, +2, +29, +0, +21, +21, +35, +847
28
29getDateTimeUTC(1999_IK, 3_IK, 1_IK, +660_IK, 8_IK, 21_IK, 35_IK, 847_IK)
30+1999, +2, +28, +0, +21, +21, +35, +847
31
32getDateTimeUTC(-1_IK, 12_IK, 31_IK, -660_IK, 20_IK)
33+0, +1, +1, +0, +7, +0, +0, +0
34
35getDateTimeUTC(1_IK, 1_IK, 1_IK, +660_IK)
36+0, +12, +31, +0, +13, +0, +0, +0
37
Test:
test_pm_dateTime


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.

  1. 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.
  2. 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.

Author:
Amir Shahmoradi, March 22, 2012, 3:59 AM, National Institute for Fusion Studies, The University of Texas Austin

Definition at line 1917 of file pm_dateTime.F90.


The documentation for this interface was generated from the following file: