Compact representation of date and time Stores all components in minimal integer kinds to reduce memory usage. All fields are public for easy access.
Constructor interface for datetime type.
The date implementation proposed here is kept at the bare minimum of what is required by the library. There are many other implementations that can be found.
Initializes a new instance of the datetime class
type(datetime) function datetime(character(*) string, (optional) character(*) fmt)
| [in] | string | date as string |
| [in] | fmt | (optional) date format |
Examples
type(datetime) function datetime((optional) integer year, (optional) integer month, ...)
| [in] | year | (optional) |
| [in] | month | (optional) |
| [in] | day | (optional) |
| [in] | hour | (optional) |
| [in] | minute | (optional) |
| [in] | second | (optional) |
| [in] | millisecond | (optional) |
Examples
Remarks
Variables | |
| integer(i2), public | year |
| Year. | |
| integer(i1), public | month |
| Month. | |
| integer(i1), public | day |
| Day. | |
| integer(i1), public | hour |
| Hour. | |
| integer(i1), public | minute |
| Minute. | |
| integer(i1), public | second |
| Second. | |
| integer(i2), public | millisecond |
| Millisecond. | |
| procedure, pass, public parse | ( | class(datetime), intent(inout) | this, |
| character(*), intent(in) | string, | ||
| character(*), intent(in), optional | fmt ) |
Parse date/time from string using common formats.
Supports ISO, US, and abbreviated month formats. On error, defaults to Unix epoch (1970-01-01 00:00:00) Perform conversion to ISO string
Remarks
| procedure, pass, public to_string | ( | class(datetime), intent(in) | this, |
| character(*), intent(in), optional | fmt ) |