current version 1.3 - 31st May 2023
version | date | comment |
---|---|---|
1.0 | 09/Nov/2008 | Original code |
1.1 | 12/Jun/2011 | Add function to DateTimeIsDefault |
1.2 | 30/Mar/2018 | date transformed to UTC in TimeDifference before computing difference |
1.3 | 31/May/2023 | new function GetDayOfWeek |
license: GNU GPL http://www.gnu.org/licenses/
This file is part of
MOSAICO -- MOdular library for raSter bAsed hydrologIcal appliCatiOn.
Copyright (C) 2011 Giovanni Ravazzani
Language: Fortran 90.
Software Standards: "European Standards for Writing and
Documenting Exchangeable Fortran 90 Code".
set of fortran routines to manage date and time.
The module adhers to the International Standard ISO 8601 specifications.
Date and time is expressed in the form YYYY-MM-DDThh:mm:ssTZD
where:
YYYY
= four-digit year
MM
= two-digit month (01=January, etc.)
DD
= two-digit day of month (01 through 31)
hh
= two digits of hour (00 through 23) (am/pm NOT allowed)
mm
= two digits of minute (00 through 59)
ss
= two digits of second (00 through 59)
TZD
= time zone designator (+hh:mm or -hh:mm)
A time zone offset of "+hh:mm" indicates that the date/time uses a local
time zone which is hh
hours and mm
minutes ahead of UTC
(Coordinated Universal Time). A time zone offset of "-hh:mm"
indicates that the date/time uses a local time zone which is
hh
hours and mm
minutes behind UTC.
Example: 2007-03-05T01:00:00+02:00
This standard notation helps to avoid confusion in international communication caused by the many different national notations and increases the portability of computer user interfaces. In addition, these formats have several important advantages for computer usage compared to other traditional date and time notations.
References: http://www.w3.org/TR/NOTE-datetime
http://en.wikipedia.org/wiki/ISO_8601
http://www.probabilityof.com/iso/8601v2000.pdf
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=timeStringLength), | public, | parameter | :: | timeDefault | = | '0000-00-00T00:00:00+00:00' | |
character(len=timeStringLength), | public | :: | timeString | ||||
integer, | public, | parameter | :: | timeStringLength | = | 25 |
Converts the value of the current DateTime
object to its equivalent
string representation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=timeStringLength), | intent(out) | :: | string | |||
type(DateTime), | intent(in) | :: | time |
Converts the specified string representation of a
date and time to its DateTime
equivalent.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(out) | :: | time | |||
character(len=timeStringLength), | intent(in) | :: | string |
Create an exact copy of DateTime
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(out) | :: | time2 | |||
type(DateTime), | intent(in) | :: | time1 |
Adds the specified number of seconds to the value of this instance. If number of seconds is a negative number, the amount is subtracted
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time1 | |||
integer, | intent(in) | :: | step |
calculate the difference in seconds between two date: time1 - time2
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time1 | |||
type(DateTime), | intent(in) | :: | time2 |
return true
if time1 is different from time2
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time1 | |||
type(DateTime), | intent(in) | :: | time2 |
return true
if time1 is less than time2
or time1 is equal to time2
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time1 | |||
type(DateTime), | intent(in) | :: | time2 |
return true
if time1 is greater than time2
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time1 | |||
type(DateTime), | intent(in) | :: | time2 |
return true
if time1 is greater than time2
or time1 is equal to time2
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time1 | |||
type(DateTime), | intent(in) | :: | time2 |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=short), | public | :: | TZhour | ||||
integer(kind=short), | public | :: | TZminute | ||||
character(len=1), | public | :: | TZsign | ||||
integer(kind=short), | public | :: | day | ||||
integer(kind=short), | public | :: | hour | ||||
integer(kind=short), | public | :: | minute | ||||
integer(kind=short), | public | :: | month | ||||
integer(kind=short), | public | :: | second | ||||
integer(kind=short), | public | :: | year |
Check if datetime is set to default
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time |
Gets the day of the year represented by this instance. Returns 366 for leap years
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time | |||
character(len=*), | intent(in), | optional | :: | leap |
Gets the day of the datetime represented by this instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time |
Gets the day of week (0 - 6) (Sunday to Saturday The formula is:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time |
returned value
Gets the month of the datetime represented by this instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time |
Gets the minute of the datetime represented by this instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time |
Gets the month of the datetime represented by this instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time |
Gets the second of the datetime represented by this instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time |
Gets the string representing time zone of the datetime represented by this instance. Example: '+02:00'
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time |
Gets the year of the datetime represented by this instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time |
Returns true
if the specified year is a leap year
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | year |
Returns true if datetime object is expressed in UTC
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time |
Gets a DateTime
object that is set to the current date and time on
this computer, expressed as the local time.
Gets a DateTime
object that is set to the current date and time on
this computer, expressed as the Coordinated Universal Time (UTC).
Returns the number of days in the specified month. It accounts for leap years
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | month | |||
integer(kind=short), | intent(in) | :: | year |
Gets the second of the year represented by this instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time |
Gets the second to the end of the year represented by this instance.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time |
Set the day of the datetime represented by this instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | day | |||
type(DateTime), | intent(out) | :: | time |
Set the hour of the datetime represented by this instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | hour | |||
type(DateTime), | intent(out) | :: | time |
Set the minute of the datetime represented by this instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | minute | |||
type(DateTime), | intent(out) | :: | time |
Set the month of the datetime represented by this instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | month | |||
type(DateTime), | intent(out) | :: | time |
Set the second of the datetime represented by this instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | second | |||
type(DateTime), | intent(out) | :: | time |
Set the timezone of the datetime represented by this instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | timeZone | |||
type(DateTime), | intent(out) | :: | time |
Set the year of the datetime represented by this instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | year | |||
type(DateTime), | intent(out) | :: | time |
check that date do not contain errors.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(in) | :: | time |
Converts the specified string representation of a
date and time to its DateTime
equivalent.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(DateTime), | intent(out) | :: | time | |||
character(len=timeStringLength), | intent(in) | :: | string |
Converts the value of the current DateTime
object to its equivalent
string representation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=timeStringLength), | intent(out) | :: | string | |||
type(DateTime), | intent(in) | :: | time |