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

Generate and return the time zone abbreviation corresponding to the current local time or the specified zone in minutes. More...

Detailed Description

Generate and return the time zone abbreviation corresponding to the current local time or the specified zone in minutes.

The time zone abbreviation is difficult to infer and generally requires communication with the operating system, which may or may not have it.
The current implementation of this generic interface relies on a predefined internal list of time zone abbreviations to convert the specified zone in units of minutes to an abbreviation.
Where there are multiple time zone abbreviations available for a single time zone, only a single representative abbreviation is kept in the list.
See the documentation of timeZone_type for the current internal list of zones and abbreviations used by the ParaMonte library.

Parameters
[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 = getZone())
Returns
abbr : The output scalar of type integer of default kind IK containing the local time difference in minutes with respect to the Coordinated Universal Time (UTC).


Possible calling interfaces

character(:, SK), allocatable :: abbr
integer(IK) :: zone
abbr = getZoneAbbr()
abbr = getZoneAbbr(zone)
Generate and return the time zone abbreviation corresponding to the current local time or the specifi...
This module contains classes and procedures for computing, manipulating, and styling dates and times.
Warning
When the input argument zone is out of the supported range ( \(-12\times60\) minutes UTC and \(+14\times60\) minutes UTC), the output string will be empty.
This generic interface does not currently take into account the daylight savings calendar.
This can lead to shifts in the output zones by up to one hour.
See also
getMillisecond
getSecond
getMinute
getHour12
getHour
getZone
getZoneAbbr
getDay
getMonth
getYear
isLeapYear


Example usage

1program example
2
3 use pm_kind, only: SK, IK
4 use pm_io, only: display_type
5 use pm_dateTime, only: getZoneAbbr
6 use pm_val2str, only: getStr
7
8 implicit none
9
10 integer(IK) :: zone
11 type(display_type) :: disp
12 disp = display_type(file = "main.out.F90")
13
14 call disp%skip()
15 call disp%show("getZoneAbbr()")
16 call disp%show( getZoneAbbr() )
17 call disp%skip()
18
19 call disp%skip()
20 do zone = -12 * 60 - 40, 14 * 60 + 40, 30
21 call disp%skip()
22 call disp%show("zone")
23 call disp%show( zone )
24 call disp%show("getZoneAbbr(zone)")
25 call disp%show( getZoneAbbr(zone) , deliml = SK_"""" )
26 call disp%skip()
27 end do
28
29end program example
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
Generate and return the conversion of the input value to an output Fortran string,...
Definition: pm_val2str.F90:167
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
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
This module contains the generic procedures for converting values of different types and kinds to For...
Definition: pm_val2str.F90:58
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
3EST
4
5
6
7zone
8-760
9getZoneAbbr(zone)
10""
11
12
13zone
14-730
15getZoneAbbr(zone)
16""
17
18
19zone
20-700
21getZoneAbbr(zone)
22"IDLW"
23
24
25zone
26-670
27getZoneAbbr(zone)
28"IDLW"
29
30
31zone
32-640
33getZoneAbbr(zone)
34"SST"
35
36
37zone
38-610
39getZoneAbbr(zone)
40"SST"
41
42
43zone
44-580
45getZoneAbbr(zone)
46"HST"
47
48
49zone
50-550
51getZoneAbbr(zone)
52"MIT"
53
54
55zone
56-520
57getZoneAbbr(zone)
58"AKST"
59
60
61zone
62-490
63getZoneAbbr(zone)
64"AKST"
65
66
67zone
68-460
69getZoneAbbr(zone)
70"PST"
71
72
73zone
74-430
75getZoneAbbr(zone)
76"PST"
77
78
79zone
80-400
81getZoneAbbr(zone)
82"MST"
83
84
85zone
86-370
87getZoneAbbr(zone)
88"MST"
89
90
91zone
92-340
93getZoneAbbr(zone)
94"CST"
95
96
97zone
98-310
99getZoneAbbr(zone)
100"CST"
101
102
103zone
104-280
105getZoneAbbr(zone)
106"EST"
107
108
109zone
110-250
111getZoneAbbr(zone)
112"EST"
113
114
115zone
116-220
117getZoneAbbr(zone)
118"EST"
119
120
121zone
122-190
123getZoneAbbr(zone)
124"NST"
125
126
127zone
128-160
129getZoneAbbr(zone)
130"UYT"
131
132
133zone
134-130
135getZoneAbbr(zone)
136"NDT"
137
138
139zone
140-100
141getZoneAbbr(zone)
142"UYST"
143
144
145zone
146-70
147getZoneAbbr(zone)
148"UYST"
149
150
151zone
152-40
153getZoneAbbr(zone)
154"EGT"
155
156
157zone
158-10
159getZoneAbbr(zone)
160"EGT"
161
162
163zone
164+20
165getZoneAbbr(zone)
166"UTC"
167
168
169zone
170+50
171getZoneAbbr(zone)
172"UTC"
173
174
175zone
176+80
177getZoneAbbr(zone)
178"CET"
179
180
181zone
182+110
183getZoneAbbr(zone)
184"CET"
185
186
187zone
188+140
189getZoneAbbr(zone)
190"EET"
191
192
193zone
194+170
195getZoneAbbr(zone)
196"EET"
197
198
199zone
200+200
201getZoneAbbr(zone)
202"AST"
203
204
205zone
206+230
207getZoneAbbr(zone)
208"IRST"
209
210
211zone
212+260
213getZoneAbbr(zone)
214"GET"
215
216
217zone
218+290
219getZoneAbbr(zone)
220"AFT"
221
222
223zone
224+320
225getZoneAbbr(zone)
226"PKT"
227
228
229zone
230+350
231getZoneAbbr(zone)
232"NPT"
233
234
235zone
236+380
237getZoneAbbr(zone)
238"BST"
239
240
241zone
242+410
243getZoneAbbr(zone)
244"MMT"
245
246
247zone
248+440
249getZoneAbbr(zone)
250"THA"
251
252
253zone
254+470
255getZoneAbbr(zone)
256"THA"
257
258
259zone
260+500
261getZoneAbbr(zone)
262"SST"
263
264
265zone
266+530
267getZoneAbbr(zone)
268"CWST"
269
270
271zone
272+560
273getZoneAbbr(zone)
274"JST"
275
276
277zone
278+590
279getZoneAbbr(zone)
280"ACST"
281
282
283zone
284+620
285getZoneAbbr(zone)
286"AEST"
287
288
289zone
290+650
291getZoneAbbr(zone)
292"LHST"
293
294
295zone
296+680
297getZoneAbbr(zone)
298"PONT"
299
300
301zone
302+710
303getZoneAbbr(zone)
304"PONT"
305
306
307zone
308+740
309getZoneAbbr(zone)
310"NZST"
311
312
313zone
314+770
315getZoneAbbr(zone)
316"CHAST"
317
318
319zone
320+800
321getZoneAbbr(zone)
322"TOT"
323
324
325zone
326+830
327getZoneAbbr(zone)
328"CHADT"
329
330
331zone
332+860
333getZoneAbbr(zone)
334""
335
336
Test:
test_pm_dateTime
Todo:
High Priority: Currently, the zone abbreviation is derived from a predefined list.
The zone abbreviation must be inferred directly from the operating system.
On Windows, this could be also be done via the Powershell command (Get-Date).IsDaylightSavingTime() to test whether the daylight savings is activated.
On Unix, The command date +"\%Z" outputs the zone abbreviation.


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, January 30, 2021, 5:36 AM, Dallas, TX

Definition at line 1258 of file pm_dateTime.F90.


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