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

This is the derived type containing the components of a numeric date and time in the Gregorian calendar. More...

Public Member Functions

procedure, pass getValues => getDateTimeIntValues
 
type(dateTimeInt_type) function dateTimeInt_typer ()
 This is the constructor of the dateTimeInt_type class.
More...
 

Public Attributes

integer(IK) year = 1_IK
 The scalar integer of default kind IK containing the year of the Gregorian calendar. More...
 
integer(IK) month = 1_IK
 The scalar integer of default kind IK containing the month of the year. More...
 
integer(IK) day = 1_IK
 The scalar integer of default kind IK containing the day of the month. More...
 
integer(IK) zone = 0_IK
 The scalar integer of default kind IK containing the time difference in minutes with respect to the UTC. More...
 
integer(IK) hour = 0_IK
 The scalar integer of default kind IK containing the hour of the day. More...
 
integer(IK) minute = 0_IK
 The scalar integer of default kind IK containing the minute of the hour. More...
 
integer(IK) second = 0_IK
 The scalar integer of default kind IK containing the second of the minute. More...
 
integer(IK) millisecond = 0_IK
 The scalar integer of default kind IK containing the milliseconds of the second. More...
 

Detailed Description

This is the derived type containing the components of a numeric date and time in the Gregorian calendar.

This class is a simple container for the values returned by the Fortran intrinsic date_and_time().


Possible calling interfaces

type(dateTimeInt_type) :: dateTimeInt
dateTimeInt = dateTimeInt_type( year = year &
, month = month &
, day = day &
, zone = zone &
, hour = hour &
, minute = minute &
, second = second &
, millisecond = millisecond &
)
This module contains classes and procedures for computing, manipulating, and styling dates and times.
This is the derived type containing the components of a numeric date and time in the Gregorian calend...
See also
dateTimeInt_typer (class constructor)
dateTimeStr_type


Example usage

1program example
2
3 use pm_kind, only: SK, IK
4 use pm_io, only: display_type
6
7 implicit none
8
9 type(dateTimeInt_type) :: dti
10
11 type(display_type) :: disp
12 disp = display_type(file = "main.out.F90")
13
14 call disp%skip()
15 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
16 call disp%show("! Construct a Gregorian calendar date and time.")
17 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
18 call disp%skip()
19
20 call disp%skip()
21 call disp%show("dti = dateTimeInt_type(year = 2020_IK, zone = -5 * 60_IK, minute = 48_IK)")
22 dti = dateTimeInt_type(year = 2020_IK, zone = -5 * 60_IK, minute = 48_IK)
23 call disp%show("write(disp%unit, ""(*(g0,:,', '))"") dti")
24 write(disp%unit, "(*(g0,:,', '))") dti
25 call disp%skip()
26
27 call disp%skip()
28 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
29 call disp%show("! Construct the current date and time and moment in the Gregorian calendar.")
30 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
31 call disp%skip()
32
33 call disp%skip()
34 call disp%show("dti = dateTimeInt_type()")
35 dti = dateTimeInt_type()
36 call disp%show("write(disp%unit, ""(*(g0,:,', '))"") dti")
37 write(disp%unit, "(*(g0,:,', '))") dti
38 call disp%skip()
39
40 call disp%skip()
41 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
42 call disp%show("! Get the object components as a vector of `Values` as returned by the Fortran instrinsic `date_and_time()`.")
43 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
44 call disp%skip()
45
46 call disp%skip()
47 call disp%show("dti = dateTimeInt_type(year = 2020_IK, zone = -5 * 60_IK, minute = 48_IK)")
48 dti = dateTimeInt_type(year = 2020_IK, zone = -5 * 60_IK, minute = 48_IK)
49 call disp%show("write(disp%unit, ""(*(g0,:,', '))"") dti")
50 write(disp%unit, "(*(g0,:,', '))") dti
51 call disp%show("dti%getValues()")
52 call disp%show( dti%getValues() )
53 call disp%show("size(dti%getValues())")
54 call disp%show( size(dti%getValues()) )
55 call disp%skip()
56
57end 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
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
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
2!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3! Construct a Gregorian calendar date and time.
4!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
6
7dti = dateTimeInt_type(year = 2020_IK, zone = -5 * 60_IK, minute = 48_IK)
8write(disp%unit, "(*(g0,:,', '))") dti
92020, 1, 1, -300, 0, 48, 0, 0
10
11
12!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13! Construct the current date and time and moment in the Gregorian calendar.
14!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15
16
17dti = dateTimeInt_type()
18write(disp%unit, "(*(g0,:,', '))") dti
192024, 10, 27, -300, 22, 32, 27, 519
20
21
22!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23! Get the object components as a vector of `Values` as returned by the Fortran instrinsic `date_and_time()`.
24!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25
26
27dti = dateTimeInt_type(year = 2020_IK, zone = -5 * 60_IK, minute = 48_IK)
28write(disp%unit, "(*(g0,:,', '))") dti
292020, 1, 1, -300, 0, 48, 0, 0
30dti%getValues()
31+2020, +1, +1, -300, +0, +48, +0, +0
32size(dti%getValues())
33+8
34
35
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, 00:00 AM, National Institute for Fusion Studies, The University of Texas Austin

Definition at line 895 of file pm_dateTime.F90.

Member Function/Subroutine Documentation

◆ dateTimeInt_typer()

type(dateTimeInt_type) function pm_dateTime::dateTimeInt_type::dateTimeInt_typer

This is the constructor of the dateTimeInt_type class.

Upon return, the constructor initializes all components of the object to the current date and time.
See also the documentation details of dateTimeInt_type.

Returns
dateTimeInt : The output scalar object of class dateTimeInt_type.


Possible calling interfaces

type(dateTimeInt_type) :: dateTimeInt
dateTimeInt = dateTimeInt_type()
Warning
All object components are set to -huge(0_K) if the processor does not provide date and time.
This condition is verified only if the library is built with the preprocessor macro CHECK_ENABLED=1.
Remarks
See the documentation of dateTimeInt_type for example usage.


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, 00:00 AM, National Institute for Fusion Studies, The University of Texas Austin

Definition at line 4092 of file pm_dateTime.F90.

◆ getValues()

procedure, pass pm_dateTime::dateTimeInt_type::getValues

Definition at line 907 of file pm_dateTime.F90.

Member Data Documentation

◆ day

integer(IK) pm_dateTime::dateTimeInt_type::day = 1_IK

The scalar integer of default kind IK containing the day of the month.

Definition at line 899 of file pm_dateTime.F90.

◆ hour

integer(IK) pm_dateTime::dateTimeInt_type::hour = 0_IK

The scalar integer of default kind IK containing the hour of the day.

Definition at line 902 of file pm_dateTime.F90.

◆ millisecond

integer(IK) pm_dateTime::dateTimeInt_type::millisecond = 0_IK

The scalar integer of default kind IK containing the milliseconds of the second.

Definition at line 905 of file pm_dateTime.F90.

◆ minute

integer(IK) pm_dateTime::dateTimeInt_type::minute = 0_IK

The scalar integer of default kind IK containing the minute of the hour.

Definition at line 903 of file pm_dateTime.F90.

◆ month

integer(IK) pm_dateTime::dateTimeInt_type::month = 1_IK

The scalar integer of default kind IK containing the month of the year.

Definition at line 898 of file pm_dateTime.F90.

◆ second

integer(IK) pm_dateTime::dateTimeInt_type::second = 0_IK

The scalar integer of default kind IK containing the second of the minute.

Definition at line 904 of file pm_dateTime.F90.

◆ year

integer(IK) pm_dateTime::dateTimeInt_type::year = 1_IK

The scalar integer of default kind IK containing the year of the Gregorian calendar.

Definition at line 897 of file pm_dateTime.F90.

◆ zone

integer(IK) pm_dateTime::dateTimeInt_type::zone = 0_IK

The scalar integer of default kind IK containing the time difference in minutes with respect to the UTC.

Definition at line 900 of file pm_dateTime.F90.


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