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

Generate and return the current or the requested date and time in the requested time zone newzone (in units of minutes) as an integer-valued array of size 8.
More...

Detailed Description

Generate and return the current or the requested date and time in the requested time zone newzone (in units of minutes) as an integer-valued array of size 8.

If there is no input argument besides newzone, then the output is the current date and time in the specified zone newzone.
When the input argument values(:) is present, 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 old date and time zone of interest to be converted to the new time zone.
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]newzone: The input scalar of type integer of default kind IK, containing the new time zone of the Gregorian calendar in minutes.
[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 only if 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 to be used to convert the UTC date and time to the local date and time.
(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 except newzone are missing.)
Returns
DateTimeNewZone(1:8) : The output vector of size 8 of type integer of default kind IK containing the requested date and time of the Gregorian Calendar in the new time zone newzone corresponding to the input date and time in the order [year, month, day, zone, hour, minute, seconds, milliseconds]. By definition, DateTimeNewZone(4) (corresponding to the zone in minutes) has the same values as the input argument newzone.


Possible calling interfaces

use pm_kind, only: SK, IK
integer(IK) :: DateTimeNewZone(8)
integer(IK) :: DateTime(8)
DateTimeNewZone(1:8) = getDateTimeNewZone(newzone) ! return the current date and time in the specified zone `newzone`.
DateTimeNewZone(1:8) = getDateTimeNewZone(newzone, year, month, day, zone)
DateTimeNewZone(1:8) = getDateTimeNewZone(newzone, year, month, day, zone, hour)
DateTimeNewZone(1:8) = getDateTimeNewZone(newzone, year, month, day, zone, hour, minute)
DateTimeNewZone(1:8) = getDateTimeNewZone(newzone, year, month, day, zone, hour, minute, second)
DateTimeNewZone(1:8) = getDateTimeNewZone(newzone, year, month, day, zone, hour, minute, second, millisecond)
DateTimeNewZone(1:8) = getDateTimeNewZone(newzone, DateTime(1:8)) ! DateTime(1:8) = [year, month, day, zone, hour, minute, second, millisecond]
DateTimeNewZone(1:8) = getDateTimeNewZone(newzone, DateTime(1:7)) ! DateTime(1:7) = [year, month, day, zone, hour, minute, second]
DateTimeNewZone(1:8) = getDateTimeNewZone(newzone, DateTime(1:6)) ! DateTime(1:6) = [year, month, day, zone, hour, minute]
DateTimeNewZone(1:8) = getDateTimeNewZone(newzone, DateTime(1:5)) ! DateTime(1:5) = [year, month, day, zone, hour]
DateTimeNewZone(1:8) = getDateTimeNewZone(newzone, DateTime(1:4)) ! DateTime(1:4) = [year, month, day, zone]
!
Generate and return the current or the requested date and time in the requested time zone newzone (in...
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 optional input arguments are missing.
See also
getDateTime
getJulianDay
getDateTimeUTC


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
8
9 implicit none
10
11 integer(IK) :: DateTime(8)
12 integer(IK) :: DateTimeUTC(8)
13 integer(IK) :: DateTimeNewZone(8)
14
15 type(display_type) :: disp
16 disp = display_type(file = "main.out.F90")
17
18 call disp%skip()
19 call disp%show("DateTime = getDateTime()")
20 DateTime = getDateTime()
21 call disp%show("DateTime")
22 call disp%show( DateTime )
23 call disp%show("DateTimeNewZone = getDateTimeNewZone(newzone = DateTime(4))")
24 DateTimeNewZone = getDateTimeNewZone(newzone = DateTime(4))
25 call disp%show("DateTimeNewZone")
26 call disp%show( DateTimeNewZone )
27 call disp%skip()
28
29 call disp%skip()
30 call disp%show("DateTime = getDateTime()")
31 DateTime = getDateTime()
32 call disp%show("DateTime")
33 call disp%show( DateTime )
34 call disp%show("DateTimeNewZone = getDateTimeNewZone(newzone = -DateTime(4))")
35 DateTimeNewZone = getDateTimeNewZone(newzone = -DateTime(4))
36 call disp%show("DateTimeNewZone")
37 call disp%show( DateTimeNewZone )
38 call disp%skip()
39
40 call disp%skip()
41 call disp%show("DateTimeUTC = getDateTimeUTC()")
42 DateTimeUTC = getDateTimeUTC()
43 call disp%show("DateTimeUTC")
44 call disp%show( DateTimeUTC )
45 call disp%show("DateTimeNewZone = getDateTimeNewZone(newzone = DateTimeUTC(4), Values = DateTimeUTC)")
46 DateTimeNewZone = getDateTimeNewZone(newzone = DateTimeUTC(4), Values = DateTimeUTC)
47 call disp%show("DateTimeNewZone")
48 call disp%show( DateTimeNewZone )
49 call disp%skip()
50
51 call disp%skip()
52 call disp%show("DateTimeUTC = getDateTimeUTC()")
53 DateTimeUTC = getDateTimeUTC()
54 call disp%show("DateTimeUTC")
55 call disp%show( DateTimeUTC )
56 call disp%show("DateTimeNewZone = getDateTimeNewZone(newzone = 0_IK, Values = DateTimeUTC)")
57 DateTimeNewZone = getDateTimeNewZone(newzone = 0_IK, Values = DateTimeUTC)
58 call disp%show("DateTimeNewZone")
59 call disp%show( DateTimeNewZone )
60 call disp%skip()
61
62 call disp%skip()
63 call disp%show("getDateTimeNewZone(-660_IK, 2000_IK, 12_IK, 31_IK, -660_IK)")
64 call disp%show( getDateTimeNewZone(-660_IK, 2000_IK, 12_IK, 31_IK, -660_IK) )
65
66 call disp%skip()
67 call disp%show("getDateTimeNewZone(0_IK, 2000_IK, 12_IK, 31_IK, -660_IK)")
68 call disp%show( getDateTimeNewZone(0_IK, 2000_IK, 12_IK, 31_IK, -660_IK) )
69
70 call disp%skip()
71 call disp%show("getDateTimeNewZone(+660_IK, 2000_IK, 12_IK, 31_IK, -660_IK)")
72 call disp%show( getDateTimeNewZone(+660_IK, 2000_IK, 12_IK, 31_IK, -660_IK) )
73 call disp%skip()
74
75 call disp%skip()
76 call disp%show("getDateTimeNewZone(-660_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK)")
77 call disp%show( getDateTimeNewZone(-660_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK) )
78
79 call disp%skip()
80 call disp%show("getDateTimeNewZone(0_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK)")
81 call disp%show( getDateTimeNewZone(0_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK) )
82
83 call disp%skip()
84 call disp%show("getDateTimeNewZone(+660_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK)")
85 call disp%show( getDateTimeNewZone(+660_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK) )
86 call disp%skip()
87
88 call disp%skip()
89 call disp%show("getDateTimeNewZone(300_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK)")
90 call disp%show( getDateTimeNewZone(300_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK) )
91
92 call disp%skip()
93 call disp%show("getDateTimeNewZone(313_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK)")
94 call disp%show( getDateTimeNewZone(313_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK) )
95
96 call disp%skip()
97 call disp%show("getDateTimeNewZone(300_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK, 35_IK)")
98 call disp%show( getDateTimeNewZone(300_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK, 35_IK) )
99
100 call disp%skip()
101 call disp%show("getDateTimeNewZone(300_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK, 35_IK, 847_IK)")
102 call disp%show( getDateTimeNewZone(300_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK, 35_IK, 847_IK) )
103
104 call disp%skip()
105 call disp%show("getDateTimeNewZone(300_IK, 2000_IK, 2_IK, 29_IK, -660_IK, 18_IK, 21_IK, 35_IK, 847_IK)")
106 call disp%show( getDateTimeNewZone(300_IK, 2000_IK, 2_IK, 29_IK, -660_IK, 18_IK, 21_IK, 35_IK, 847_IK) )
107
108 call disp%skip()
109 call disp%show("getDateTimeNewZone(-300_IK, 2000_IK, 3_IK, 1_IK, +660_IK, 8_IK, 21_IK, 35_IK, 847_IK)")
110 call disp%show( getDateTimeNewZone(-300_IK, 2000_IK, 3_IK, 1_IK, +660_IK, 8_IK, 21_IK, 35_IK, 847_IK) )
111
112 call disp%skip()
113 call disp%show("getDateTimeNewZone(-300_IK, 1999_IK, 3_IK, 1_IK, +660_IK, 8_IK, 21_IK, 35_IK, 847_IK)")
114 call disp%show( getDateTimeNewZone(-300_IK, 1999_IK, 3_IK, 1_IK, +660_IK, 8_IK, 21_IK, 35_IK, 847_IK) )
115
116 call disp%skip()
117 call disp%show("getDateTimeNewZone(300_IK, -1_IK, 12_IK, 31_IK, -660_IK, 20_IK)")
118 call disp%show( getDateTimeNewZone(300_IK, -1_IK, 12_IK, 31_IK, -660_IK, 20_IK) )
119
120 call disp%skip()
121 call disp%show("getDateTimeNewZone(300_IK, 1_IK, 1_IK, 1_IK, +660_IK)")
122 call disp%show( getDateTimeNewZone(300_IK, 1_IK, 1_IK, 1_IK, +660_IK) )
123
124end program example
Generate and return the current or the requested date and time converted to the corresponding Coordin...
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
2DateTime = getDateTime()
3DateTime
4+2024, +8, +22, -240, +20, +23, +4, +583
5DateTimeNewZone = getDateTimeNewZone(newzone = DateTime(4))
6DateTimeNewZone
7+2024, +8, +22, -240, +20, +23, +4, +583
8
9
10DateTime = getDateTime()
11DateTime
12+2024, +8, +22, -240, +20, +23, +4, +583
13DateTimeNewZone = getDateTimeNewZone(newzone = -DateTime(4))
14DateTimeNewZone
15+2024, +8, +23, +240, +4, +23, +4, +583
16
17
18DateTimeUTC = getDateTimeUTC()
19DateTimeUTC
20+2024, +8, +23, +0, +0, +23, +4, +583
21DateTimeNewZone = getDateTimeNewZone(newzone = DateTimeUTC(4), Values = DateTimeUTC)
22DateTimeNewZone
23+2024, +8, +23, +0, +0, +23, +4, +583
24
25
26DateTimeUTC = getDateTimeUTC()
27DateTimeUTC
28+2024, +8, +23, +0, +0, +23, +4, +583
29DateTimeNewZone = getDateTimeNewZone(newzone = 0_IK, Values = DateTimeUTC)
30DateTimeNewZone
31+2024, +8, +23, +0, +0, +23, +4, +583
32
33
34getDateTimeNewZone(-660_IK, 2000_IK, 12_IK, 31_IK, -660_IK)
35+2000, +12, +31, -660, +0, +0, +0, +0
36
37getDateTimeNewZone(0_IK, 2000_IK, 12_IK, 31_IK, -660_IK)
38+2000, +12, +31, +0, +11, +0, +0, +0
39
40getDateTimeNewZone(+660_IK, 2000_IK, 12_IK, 31_IK, -660_IK)
41+2000, +12, +31, +660, +22, +0, +0, +0
42
43
44getDateTimeNewZone(-660_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK)
45+2000, +12, +31, -660, +18, +0, +0, +0
46
47getDateTimeNewZone(0_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK)
48+2001, +1, +1, +0, +5, +0, +0, +0
49
50getDateTimeNewZone(+660_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK)
51+2001, +1, +1, +660, +16, +0, +0, +0
52
53
54getDateTimeNewZone(300_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK)
55+2001, +1, +1, +300, +10, +21, +0, +0
56
57getDateTimeNewZone(313_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK)
58+2001, +1, +1, +313, +10, +34, +0, +0
59
60getDateTimeNewZone(300_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK, 35_IK)
61+2001, +1, +1, +300, +10, +21, +35, +0
62
63getDateTimeNewZone(300_IK, 2000_IK, 12_IK, 31_IK, -660_IK, 18_IK, 21_IK, 35_IK, 847_IK)
64+2001, +1, +1, +300, +10, +21, +35, +847
65
66getDateTimeNewZone(300_IK, 2000_IK, 2_IK, 29_IK, -660_IK, 18_IK, 21_IK, 35_IK, 847_IK)
67+2000, +3, +1, +300, +10, +21, +35, +847
68
69getDateTimeNewZone(-300_IK, 2000_IK, 3_IK, 1_IK, +660_IK, 8_IK, 21_IK, 35_IK, 847_IK)
70+2000, +2, +29, -300, +16, +21, +35, +847
71
72getDateTimeNewZone(-300_IK, 1999_IK, 3_IK, 1_IK, +660_IK, 8_IK, 21_IK, 35_IK, 847_IK)
73+1999, +2, +28, -300, +16, +21, +35, +847
74
75getDateTimeNewZone(300_IK, -1_IK, 12_IK, 31_IK, -660_IK, 20_IK)
76+0, +1, +1, +300, +12, +0, +0, +0
77
78getDateTimeNewZone(300_IK, 1_IK, 1_IK, 1_IK, +660_IK)
79+0, +12, +31, +300, +18, +0, +0, +0
80
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 at Austin

Definition at line 2097 of file pm_dateTime.F90.


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