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

This is the derived type containing the string components that contain numeric date and time in the Gregorian calendar. More...

Public Member Functions

type(dateTimeStr_type) function dateTimeStr_typer ()
 This is the constructor of the dateTimeStr_type class.
More...
 

Public Attributes

character(4, SK) year = "0001"
 The scalar character of default kind SK of length 4 containing the year of the Gregorian calendar in the form yyyy. More...
 
character(2, SK) month = "01"
 The scalar character of default kind SK of length 2 containing the month of the year in the form mm. More...
 
character(2, SK) day = "01"
 The scalar character of default kind SK of length 2 containing the day of the month in the form dd. More...
 
character(5, SK) zone = "+0000"
 The scalar character of default kind SK of length 5 containing the time difference between local time and UTC (also known as Greenwich mean Time) in the form Shhmm, corresponding to sign, hours, and minutes. For example, -0500 (New York). More...
 
character(2, SK) hour = "00"
 The scalar character of default kind SK of length 2 containing the hour of the day in the form hh. More...
 
character(2, SK) minute = "00"
 The scalar character of default kind SK of length 2 containing the minute of the hour in the form mm. More...
 
character(2, SK) second = "00"
 The scalar character of default kind SK of length 2 containing the second of the minute in the form ss. More...
 
character(3, SK) millisecond = "000"
 The scalar character of default kind SK of length 3 containing the milliseconds of the second in the form sss. More...
 

Detailed Description

This is the derived type containing the string components that contain 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(dateTimeStr_type) :: dateTimeStr
dateTimeStr = dateTimeStr_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 string components that contain numeric date and time in the G...
See also
dateTimeStr_typer (class constructor)
dateTimeInt_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(dateTimeStr_type) :: dts
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("dts = dateTimeStr_type(year = '2020', zone = SK_'-5000', minute = '48')")
22 dts = dateTimeStr_type(year = '2020', zone = SK_'-5000', minute = '48')
23 call disp%show("write(disp%unit, ""(*('''',g0,'''',:,', '))"") dts")
24 write(disp%unit, "(*('''',g0,'''',:,', '))") dts
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("dts = dateTimeStr_type()")
35 dts = dateTimeStr_type()
36 call disp%show("write(disp%unit, ""(*('''',g0,'''',:,', '))"") dts")
37 write(disp%unit, "(*('''',g0,'''',:,', '))") dts
38 call disp%skip()
39
40end 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
7dts = dateTimeStr_type(year = '2020', zone = SK_'-5000', minute = '48')
8write(disp%unit, "(*('''',g0,'''',:,', '))") dts
9'2020', '01', '01', '-5000', '00', '48', '00', '000'
10
11
12!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13! Construct the current date and time and moment in the Gregorian calendar.
14!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15
16
17dts = dateTimeStr_type()
18write(disp%unit, "(*('''',g0,'''',:,', '))") dts
19'2024', '08', '22', '-0400', '20', '22', '58', '962'
20
21
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 at Austin

Definition at line 957 of file pm_dateTime.F90.

Member Function/Subroutine Documentation

◆ dateTimeStr_typer()

type(dateTimeStr_type) function pm_dateTime::dateTimeStr_type::dateTimeStr_typer

This is the constructor of the dateTimeStr_type class.

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

Returns
dateTimeStr : The output scalar object of class dateTimeStr_type.


Possible calling interfaces

type(dateTimeStr_type) :: dateTimeStr
dateTimeStr = dateTimeStr_type()
Warning
All object components are set to blanks 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 dateTimeStr_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 at Austin

Definition at line 4193 of file pm_dateTime.F90.

Member Data Documentation

◆ day

character(2, SK) pm_dateTime::dateTimeStr_type::day = "01"

The scalar character of default kind SK of length 2 containing the day of the month in the form dd.

Definition at line 963 of file pm_dateTime.F90.

◆ hour

character(2, SK) pm_dateTime::dateTimeStr_type::hour = "00"

The scalar character of default kind SK of length 2 containing the hour of the day in the form hh.

Definition at line 967 of file pm_dateTime.F90.

◆ millisecond

character(3, SK) pm_dateTime::dateTimeStr_type::millisecond = "000"

The scalar character of default kind SK of length 3 containing the milliseconds of the second in the form sss.

Definition at line 970 of file pm_dateTime.F90.

◆ minute

character(2, SK) pm_dateTime::dateTimeStr_type::minute = "00"

The scalar character of default kind SK of length 2 containing the minute of the hour in the form mm.

Definition at line 968 of file pm_dateTime.F90.

◆ month

character(2, SK) pm_dateTime::dateTimeStr_type::month = "01"

The scalar character of default kind SK of length 2 containing the month of the year in the form mm.

Definition at line 962 of file pm_dateTime.F90.

◆ second

character(2, SK) pm_dateTime::dateTimeStr_type::second = "00"

The scalar character of default kind SK of length 2 containing the second of the minute in the form ss.

Definition at line 969 of file pm_dateTime.F90.

◆ year

character(4, SK) pm_dateTime::dateTimeStr_type::year = "0001"

The scalar character of default kind SK of length 4 containing the year of the Gregorian calendar in the form yyyy.

Definition at line 961 of file pm_dateTime.F90.

◆ zone

character(5, SK) pm_dateTime::dateTimeStr_type::zone = "+0000"

The scalar character of default kind SK of length 5 containing the time difference between local time and UTC (also known as Greenwich mean Time) in the form Shhmm, corresponding to sign, hours, and minutes. For example, -0500 (New York).

Definition at line 964 of file pm_dateTime.F90.


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