Time Types

Overview

The primitive Date/Time types used in openEHR are represented by classes defined in the package base.foundation_types.time. These are concrete types based on the ISO 8601 (2004) date/time standard semantics, which supports partial dates, times, and complex durations, all of which are needed in the biomedical and clinical domains. These classes have a String physical representation. and are assumed to exist in close to the form specified here, because they are specified in other openEHR specifications.

The time package is shown below.

BASE foundation types.time
Figure 1. base.foundation_types.time package

Primitive Time Types

The set of ISO 8601 based types define dates and times with a String representation (as per ISO 8601), and the ISO 8601 'partial' and 'extended' semantics. They are defined as descendents of the native types described above, and add the necessary elements required for ISO 8601.

class names of the form Iso8601_xxx have been used here to clearly identify these classes where used elsewhere in the openEHR specifications. In real implementations, other class names may be used as convenient, just as for the other primitive types.
For reasons of readability in data, it is strongly recommended that the 'extended' form of date and time strings be used when writing and displaying data, rather than the compact form. An extended date has the form yyyy-mm-dd rather than yyyymmdd, and an extended time has the form hh:mm:ss rather than hhmmss. Nevertheless, both forms should be supported so that openEHR-based systems that use 'straight-through' processing on legacy data that may be in the compact form remain conformant to the specifications.

ISO 8601 semantics not included in these types include:

  • 'expanded' dates, which have year numbers of greater than 4 digits, and may be negative; in openEHR, only 4-digit year numbers are assumed;

  • the YYYY-WW-DD method of expressing dates (since this is imprecise and difficult to compute with due to variable week starting dates, and not required in health);

  • partial date/times with fractional minutes or hours, e.g. hh,hhh or mm,mm; in openEHR, only fractional seconds are supported;

  • the interval syntax. Intervals of date/times are supported in openEHR, but their syntax form is defined by ADL, and is standardised across all comparable types, not just dates and times.

Deviations from the published standard include the following:

  • durations are supposed to take the form of PnnW or PnnYnnMnnDTnnHnnMnnS, but in openEHR, the W (week) designator can be used in combination with the other designators, since it is very common to state durations of pregnancy as some combination of weeks and days.

  • partial variants of Iso8601_date_time can include missing hours, days and months, whereas ISO 8601:2004 (section 4.3.3 c) only allows missing seconds and minutes. The reasons for this deviation are:

    • the same deviation is used in HL7v2 and HL7v3 TS (timestamp) type, i.e. there are data in existing clinical systems matching this specification;

    • in a typed object model, this deviation is more sensible anyway; the ISO 8601 rule is most likely a limitation of the purely syntactic means of expression. In real systems where a timestamp/date-time is specified in a screen form, it makes sense to allow it to be as partial as possible, rather than artifically restricted to only missing seconds and minutes.

  • the time 24:00:00 (or 240000) is not allowed anywhere, whereas in ISO 8601:2004 it appears to be legal at least for pure times. This deviation is also appears to be used in HL7v2 and HL7v3 (where midnight is defined as the time 00:00:00), and is preferable to the documented standard, since a date/time with time of 24:00:00 is really the next day, i.e. the date part is then incorrect.

See ISO 8601 and the official ISO 8601 standard for details. Note that in the date, time and date_time formats shown below, 'Z' and 'T' are literals. In the duration class shown below, 'P', 'Y', 'M', 'W', 'D', 'H', 'S' and 'T' are literals.

Derived Interval / Time Types

A number of useful types may be generated from the Date/time classes and the Interval classes. These are shown in blue on the following diagram.

BASE foundation types.time intervals
Figure 2. Useful time interval types

Class Definitions

Time_Definitions Class

  • Definition

  • Effective

  • BMM

  • UML

Class

Time_Definitions

Description

Definitions for date/time classes. Note that the timezone limits are set by where the international dateline is. Thus, time in New Zealand is quoted using +12:00, not -12:00.

Constants

Signature

Meaning

1..1

Seconds_in_minute: Integer = 60

1..1

Minutes_in_hour: Integer = 60

1..1

Hours_in_day: Integer = 24

1..1

Nominal_days_in_month: Real = 30.42

Used for conversions of durations containing months to days and / or seconds.

1..1

Max_days_in_month: Integer = 31

1..1

Days_in_year: Integer = 365

1..1

Days_in_leap_year: Integer = 366

1..1

Max_days_in_year: Integer = Days_in_leap_year

1..1

Nominal_days_in_year: Real = 365.24

Used for conversions of durations containing years to days and / or seconds.

1..1

Days_in_week: Integer = 7

1..1

Months_in_year: Integer = 12

1..1

Min_timezone_hour: Integer = 12

Minimum hour value of a timezone (note that the -ve sign is supplied in the ISO8601_TIMEZONE class).

1..1

Max_timezone_hour: Integer = 13

Functions

Signature

Meaning

1..1

valid_year (
y: Integer[1]
): Boolean

Post: Result = y >= 0

1..1

valid_month (
m: Integer[1]
): Boolean

Post: Result = m >= 1 and m <= Months_in_year

1..1

valid_day (
y: Integer[1],
m: Integer[1],
d: Integer[1]
): Boolean

Post: Result = d >= 1 and d <= days_in_month (m, y)

True if d >= 1 and d <= days_in_month (m, y)

1..1

valid_hour (
h: Integer[1],
m: Integer[1],
s: Integer[1]
): Boolean

Post: Result = (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0)

True if (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0)

1..1

valid_minute (
m: Integer[1]
): Boolean

Post: Result = m >= 0 and m < Minutes_in_hour

True if m >= 0 and m < Minutes_in_hour.

1..1

valid_second (
s: Integer[1]
): Boolean

Post: Result = s >= 0 and s < Seconds_in_minute

True if s >= 0 and s < Seconds_in_minute .

1..1

valid_fractional_second (
fs: Double[1]
): Boolean

Post: Result = fs >= 0.0 and fs < 1.0 .

True if fs >= 0.0 and fs < 1.0 .

1..1

valid_iso8601_date (
s: String[1]
): Boolean

String is a valid ISO 8601 date, i.e. takes the complete form:

  • YYYY-MM-DD (extended, preferred) or one of the partial forms YYYY-MM or YYYY

  • YYYYMMDD (compact) or a partial variant YYYYMM.

Where:

  • YYYY is the string form of any positive number in the range 0000 - 9999 (zero-filled to four digits)

  • MM is 01 - 12 (zero-filled to two digits)

  • DD is 01 - 31 (zero-filled to two digits)

The combinations of YYYY, MM, DD numbers must be correct with respect to the Gregorian calendar.

1..1

valid_iso8601_time (
s: String[1]
): Boolean

String is a valid ISO 8601 date, i.e. takes the form:

  • hh:mm:ss[(,|.)s+][Z|±hh[:mm]] (extended)

  • hhmmss[(,|.)s+][Z|±hh[mm]] (compact)

  • or one of the partial forms:

    • hh:mm (extended)

    • hhmm or hh (compact)

with an additional optional timezone indicator of:

  • Z or`±hh[:mm]` (extended) ±hh[mm] (compact)

Where:

  • hh is "00" - "23" (0-filled to two digits)

  • mm is "00" - "59" (0-filled to two digits)

  • ss is "00" - "60" (0-filled to two digits)

  • [(,|.)s+] is an optional string consisting of a comma or decimal point followed by numeric string of 1 or more digits, representing a fractional second

  • Z is a literal meaning UTC (modern replacement for GMT), i.e. timezone +0000

1..1

valid_iso8601_date_time (
s: String[1]
): Boolean

String is a valid ISO 8601 date-time, i.e. takes the form:

  • YYYY-MM-DDThh:mm:ss[(,|.)s+][Z|±hh[:mm]] (extended)

  • YYYYMMDDThhmmss[(,|.)s+][Z|±hh[mm]] (compact)

  • or one of the partial forms:

    • YYYY-MM-DDThh:mm or YYYY-MM-DDThh (extended)

    • YYYYMMDDThhmm or YYYYMMDDThh (compact)

1..1

valid_iso8601_duration (
s: String[1]
): Boolean

String is a valid ISO 8601 duration, i.e. takes the form:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Where each nn represents a number of years, months, etc. nnW represents a number of 7-day weeks.

Note: allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).

Parameters
s

String is a valid ISO 8601 duration, i.e. takes the form:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Where each nn represents a number of years, months, etc. nnW represents a number of 7- day weeks.

allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).
Time_Definitions

Definitions for date/time classes. Note that the timezone limits are set by where the international dateline is. Thus, time in New Zealand is quoted using +12:00, not -12:00.

Constants

Seconds_in_minute: Integer = 60 [1..1]

Minutes_in_hour: Integer = 60 [1..1]

Hours_in_day: Integer = 24 [1..1]

Nominal_days_in_month: Real = 30.42 [1..1]

Used for conversions of durations containing months to days and / or seconds.

Max_days_in_month: Integer = 31 [1..1]

Days_in_year: Integer = 365 [1..1]

Days_in_leap_year: Integer = 366 [1..1]

Max_days_in_year: Integer = Days_in_leap_year [1..1]

Nominal_days_in_year: Real = 365.24 [1..1]

Used for conversions of durations containing years to days and / or seconds.

Days_in_week: Integer = 7 [1..1]

Months_in_year: Integer = 12 [1..1]

Min_timezone_hour: Integer = 12 [1..1]

Minimum hour value of a timezone (note that the -ve sign is supplied in the ISO8601_TIMEZONE class).

Max_timezone_hour: Integer = 13 [1..1]

Functions

valid_year (
y: Integer[1]
): Boolean

Post: Result = y >= 0 [1..1]

valid_month (
m: Integer[1]
): Boolean

Post: Result = m >= 1 and m <= Months_in_year [1..1]

valid_day (
y: Integer[1],
m: Integer[1],
d: Integer[1]
): Boolean

Post: Result = d >= 1 and d <= days_in_month (m, y) [1..1]

True if d >= 1 and d <= days_in_month (m, y)

valid_hour (
h: Integer[1],
m: Integer[1],
s: Integer[1]
): Boolean

Post: Result = (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0) [1..1]

True if (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0)

valid_minute (
m: Integer[1]
): Boolean

Post: Result = m >= 0 and m < Minutes_in_hour [1..1]

True if m >= 0 and m < Minutes_in_hour.

valid_second (
s: Integer[1]
): Boolean

Post: Result = s >= 0 and s < Seconds_in_minute [1..1]

True if s >= 0 and s < Seconds_in_minute .

valid_fractional_second (
fs: Double[1]
): Boolean

Post: Result = fs >= 0.0 and fs < 1.0 . [1..1]

True if fs >= 0.0 and fs < 1.0 .

valid_iso8601_date (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date, i.e. takes the complete form:

  • YYYY-MM-DD (extended, preferred) or one of the partial forms YYYY-MM or YYYY

  • YYYYMMDD (compact) or a partial variant YYYYMM.

Where:

  • YYYY is the string form of any positive number in the range 0000 - 9999 (zero-filled to four digits)

  • MM is 01 - 12 (zero-filled to two digits)

  • DD is 01 - 31 (zero-filled to two digits)

The combinations of YYYY, MM, DD numbers must be correct with respect to the Gregorian calendar.

valid_iso8601_time (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date, i.e. takes the form:

  • hh:mm:ss[(,|.)s+][Z|±hh[:mm]] (extended)

  • hhmmss[(,|.)s+][Z|±hh[mm]] (compact)

  • or one of the partial forms:

    • hh:mm (extended)

    • hhmm or hh (compact)

with an additional optional timezone indicator of:

  • Z or`±hh[:mm]` (extended) ±hh[mm] (compact)

Where:

  • hh is "00" - "23" (0-filled to two digits)

  • mm is "00" - "59" (0-filled to two digits)

  • ss is "00" - "60" (0-filled to two digits)

  • [(,|.)s+] is an optional string consisting of a comma or decimal point followed by numeric string of 1 or more digits, representing a fractional second

  • Z is a literal meaning UTC (modern replacement for GMT), i.e. timezone +0000

valid_iso8601_date_time (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date-time, i.e. takes the form:

  • YYYY-MM-DDThh:mm:ss[(,|.)s+][Z|±hh[:mm]] (extended)

  • YYYYMMDDThhmmss[(,|.)s+][Z|±hh[mm]] (compact)

  • or one of the partial forms:

    • YYYY-MM-DDThh:mm or YYYY-MM-DDThh (extended)

    • YYYYMMDDThhmm or YYYYMMDDThh (compact)

valid_iso8601_duration (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 duration, i.e. takes the form:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Where each nn represents a number of years, months, etc. nnW represents a number of 7-day weeks.

Note: allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).

Parameters
s

String is a valid ISO 8601 duration, i.e. takes the form:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Where each nn represents a number of years, months, etc. nnW represents a number of 7- day weeks.

allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).
{
    "name": "Time_Definitions",
    "documentation": "Definitions for date/time classes. Note that the timezone limits are set by where the international dateline is. Thus, time in New Zealand is quoted using `+12:00`, not `-12:00`.",
    "constants": {
        "Seconds_in_minute": {
            "name": "Seconds_in_minute",
            "type": "Integer",
            "value": 60
        },
        "Minutes_in_hour": {
            "name": "Minutes_in_hour",
            "type": "Integer",
            "value": 60
        },
        "Hours_in_day": {
            "name": "Hours_in_day",
            "type": "Integer",
            "value": 24
        },
        "Nominal_days_in_month": {
            "name": "Nominal_days_in_month",
            "documentation": "Used for conversions of durations containing months to days and / or seconds.",
            "type": "Real",
            "value": 30.42
        },
        "Max_days_in_month": {
            "name": "Max_days_in_month",
            "type": "Integer",
            "value": 31
        },
        "Days_in_year": {
            "name": "Days_in_year",
            "type": "Integer",
            "value": 365
        },
        "Days_in_leap_year": {
            "name": "Days_in_leap_year",
            "type": "Integer",
            "value": 366
        },
        "Max_days_in_year": {
            "name": "Max_days_in_year",
            "type": "Integer",
            "value": "Days_in_leap_year"
        },
        "Nominal_days_in_year": {
            "name": "Nominal_days_in_year",
            "documentation": "Used for conversions of durations containing years to days and / or seconds.",
            "type": "Real",
            "value": 365.24
        },
        "Days_in_week": {
            "name": "Days_in_week",
            "type": "Integer",
            "value": 7
        },
        "Months_in_year": {
            "name": "Months_in_year",
            "type": "Integer",
            "value": 12
        },
        "Min_timezone_hour": {
            "name": "Min_timezone_hour",
            "documentation": "Minimum hour value of a timezone (note that the -ve sign is supplied in the ISO8601_TIMEZONE class).",
            "type": "Integer",
            "value": 12
        },
        "Max_timezone_hour": {
            "name": "Max_timezone_hour",
            "type": "Integer",
            "value": 13
        }
    },
    "functions": {
        "valid_year": {
            "name": "valid_year",
            "parameters": {
                "y": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "y",
                    "type": "Integer"
                }
            },
            "post_conditions": {
                "Post": "Result = y >= 0"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "valid_month": {
            "name": "valid_month",
            "parameters": {
                "m": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "m",
                    "type": "Integer"
                }
            },
            "post_conditions": {
                "Post": "Result = m >= 1 and m <= Months_in_year"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "valid_day": {
            "name": "valid_day",
            "documentation": "True if d >= 1 and d <= days_in_month (m, y)",
            "parameters": {
                "y": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "y",
                    "type": "Integer"
                },
                "m": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "m",
                    "type": "Integer"
                },
                "d": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "d",
                    "type": "Integer"
                }
            },
            "post_conditions": {
                "Post": "Result = d >= 1 and d <= days_in_month (m, y)"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "valid_hour": {
            "name": "valid_hour",
            "documentation": "True if (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0)",
            "parameters": {
                "h": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "h",
                    "type": "Integer"
                },
                "m": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "m",
                    "type": "Integer"
                },
                "s": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "s",
                    "type": "Integer"
                }
            },
            "post_conditions": {
                "Post": "Result = (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0)"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "valid_minute": {
            "name": "valid_minute",
            "documentation": "True if m >= 0 and m < Minutes_in_hour.",
            "parameters": {
                "m": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "m",
                    "type": "Integer"
                }
            },
            "post_conditions": {
                "Post": "Result = m >= 0 and m < Minutes_in_hour"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "valid_second": {
            "name": "valid_second",
            "documentation": "True if s >= 0 and s < Seconds_in_minute .",
            "parameters": {
                "s": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "s",
                    "type": "Integer"
                }
            },
            "post_conditions": {
                "Post": "Result = s >= 0 and s < Seconds_in_minute"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "valid_fractional_second": {
            "name": "valid_fractional_second",
            "documentation": "True if fs >= 0.0 and fs < 1.0 .",
            "parameters": {
                "fs": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "fs",
                    "type": "Double"
                }
            },
            "post_conditions": {
                "Post": "Result = fs >= 0.0 and fs < 1.0 ."
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "valid_iso8601_date": {
            "name": "valid_iso8601_date",
            "documentation": "String is a valid ISO 8601 date, i.e. takes the complete form:\n\n* `YYYY-MM-DD` (extended, preferred) or one of the partial forms `YYYY-MM` or `YYYY`\n* `YYYYMMDD` (compact) or a partial variant `YYYYMM`.\n\nWhere:\n\n* `YYYY` is the string form of any positive number in the range `0000` - `9999` (zero-filled to four digits)\n* `MM` is `01` - `12` (zero-filled to two digits)\n* `DD` is `01` - `31` (zero-filled to two digits)\n\nThe combinations of `YYYY`, `MM`, `DD` numbers must be correct with respect to the Gregorian calendar.",
            "parameters": {
                "s": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "s",
                    "type": "String"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "valid_iso8601_time": {
            "name": "valid_iso8601_time",
            "documentation": "String is a valid ISO 8601 date, i.e. takes the form:\n\n* `hh:mm:ss[(,|.)s+][Z|±hh[:mm]]` (extended)\n* `hhmmss[(,|.)s+][Z|±hh[mm]]` (compact)\n* or one of the partial forms:\n** `hh:mm` (extended)\n** `hhmm` or `hh` (compact)\n\nwith an additional optional timezone indicator of:\n\n* `Z` or`±hh[:mm]` (extended)  `±hh[mm]` (compact)\n\nWhere:\n\n* `hh` is \"00\" - \"23\" (0-filled to two digits)\n* `mm` is \"00\" - \"59\" (0-filled to two digits)\n* `ss` is \"00\" - \"60\" (0-filled to two digits)\n* `[(,|.)s+]` is an optional string consisting of a comma or decimal point followed by numeric string of 1 or more digits, representing a fractional second\n* `Z` is a literal meaning UTC (modern replacement for GMT), i.e. timezone `+0000`\n",
            "parameters": {
                "s": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "s",
                    "type": "String"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "valid_iso8601_date_time": {
            "name": "valid_iso8601_date_time",
            "documentation": "String is a valid ISO 8601 date-time, i.e. takes the form:\n\n* `YYYY-MM-DDThh:mm:ss[(,|.)s+][Z|±hh[:mm]]` (extended)\n* `YYYYMMDDThhmmss[(,|.)s+][Z|±hh[mm]]` (compact)\n* or one of the partial forms:\n** `YYYY-MM-DDThh:mm` or `YYYY-MM-DDThh` (extended)\n** `YYYYMMDDThhmm` or `YYYYMMDDThh` (compact)",
            "parameters": {
                "s": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "s",
                    "type": "String"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "valid_iso8601_duration": {
            "name": "valid_iso8601_duration",
            "documentation": "String is a valid ISO 8601 duration, i.e. takes the form:\n\n* `P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]`\n\nWhere each nn represents a number of years, months, etc. nnW represents a number of 7-day weeks.\n\nNote: allowing the `W` designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).",
            "parameters": {
                "s": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "s",
                    "documentation": "String is a valid ISO 8601 duration, i.e. takes the form:\n\n* `P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]`\n\nWhere each `nn` represents a number of years, months, etc. `nnW` represents a number of 7- day weeks.\n\nNOTE: allowing the `W` designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).",
                    "type": "String"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        }
    }
}
time definitions

Temporal Class

  • Definition

  • Effective

  • BMM

  • UML

Class

Temporal (abstract)

Description

Abstract ancestor of time-related classes.

Inherit

Ordered

Temporal (abstract)

Abstract ancestor of time-related classes.

Inherits: Any, Ordered

Functions

(abstract) is_equal (
other: Any[1]
): Boolean [1..1]

Value equality.
Inherited from Any

infix = (
other: Any[1]
): Boolean [1..1]

Reference equality.
Inherited from Any

Parameters
other

Reference equality.

instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.
Inherited from Any

type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".
Inherited from Any

(abstract) infix < (
other: Ordered[1]
): Boolean [1..1]

Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability.
Inherited from Ordered

{
    "name": "Temporal",
    "documentation": "Abstract ancestor of time-related classes.",
    "is_abstract": true,
    "ancestors": [
        "Ordered"
    ]
}
temporal

Iso8601_type Class

  • Definition

  • Effective

  • BMM

  • UML

Class

Iso8601_type (abstract)

Description

Abstract ancestor type of ISO 8601 types, defining interface for 'extended' and 'partial' concepts from ISO 8601.

Inherit

Temporal, Time_Definitions

Attributes

Signature

Meaning

1..1

value: String

Representation of all descendants is a single String.

Functions

Signature

Meaning

1..1
(abstract)

is_partial (): Boolean

True if this date time is partial, i.e. if trailing end (right hand) value(s) is/are missing.

1..1
(abstract)

is_extended (): Boolean

True if this ISO8601 string is in the 'extended' form, i.e. uses ‘-’ and / or ‘:’ separators. This is the preferred format.

Iso8601_type (abstract)

Abstract ancestor type of ISO 8601 types, defining interface for 'extended' and 'partial' concepts from ISO 8601.

Inherits: Any, Ordered, Temporal, Time_Definitions

Constants

Seconds_in_minute: Integer = 60 [1..1]

+ Inherited from Time_Definitions

Minutes_in_hour: Integer = 60 [1..1]

+ Inherited from Time_Definitions

Hours_in_day: Integer = 24 [1..1]

+ Inherited from Time_Definitions

Nominal_days_in_month: Real = 30.42 [1..1]

Used for conversions of durations containing months to days and / or seconds.
Inherited from Time_Definitions

Max_days_in_month: Integer = 31 [1..1]

+ Inherited from Time_Definitions

Days_in_year: Integer = 365 [1..1]

+ Inherited from Time_Definitions

Days_in_leap_year: Integer = 366 [1..1]

+ Inherited from Time_Definitions

Max_days_in_year: Integer = Days_in_leap_year [1..1]

+ Inherited from Time_Definitions

Nominal_days_in_year: Real = 365.24 [1..1]

Used for conversions of durations containing years to days and / or seconds.
Inherited from Time_Definitions

Days_in_week: Integer = 7 [1..1]

+ Inherited from Time_Definitions

Months_in_year: Integer = 12 [1..1]

+ Inherited from Time_Definitions

Min_timezone_hour: Integer = 12 [1..1]

Minimum hour value of a timezone (note that the -ve sign is supplied in the ISO8601_TIMEZONE class).
Inherited from Time_Definitions

Max_timezone_hour: Integer = 13 [1..1]

+ Inherited from Time_Definitions

Attributes

value: String [1..1]

Representation of all descendants is a single String.

Functions

(abstract) is_equal (
other: Any[1]
): Boolean [1..1]

Value equality.
Inherited from Any

infix = (
other: Any[1]
): Boolean [1..1]

Reference equality.
Inherited from Any

Parameters
other

Reference equality.

instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.
Inherited from Any

type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".
Inherited from Any

(abstract) infix < (
other: Ordered[1]
): Boolean [1..1]

Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability.
Inherited from Ordered

valid_year (
y: Integer[1]
): Boolean

Post: Result = y >= 0 [1..1]

+ Inherited from Time_Definitions

valid_month (
m: Integer[1]
): Boolean

Post: Result = m >= 1 and m <= Months_in_year [1..1]

+ Inherited from Time_Definitions

valid_day (
y: Integer[1],
m: Integer[1],
d: Integer[1]
): Boolean

Post: Result = d >= 1 and d <= days_in_month (m, y) [1..1]

True if d >= 1 and d <= days_in_month (m, y)
Inherited from Time_Definitions

valid_hour (
h: Integer[1],
m: Integer[1],
s: Integer[1]
): Boolean

Post: Result = (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0) [1..1]

True if (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0)
Inherited from Time_Definitions

valid_minute (
m: Integer[1]
): Boolean

Post: Result = m >= 0 and m < Minutes_in_hour [1..1]

True if m >= 0 and m < Minutes_in_hour.
Inherited from Time_Definitions

valid_second (
s: Integer[1]
): Boolean

Post: Result = s >= 0 and s < Seconds_in_minute [1..1]

True if s >= 0 and s < Seconds_in_minute .
Inherited from Time_Definitions

valid_fractional_second (
fs: Double[1]
): Boolean

Post: Result = fs >= 0.0 and fs < 1.0 . [1..1]

True if fs >= 0.0 and fs < 1.0 .
Inherited from Time_Definitions

valid_iso8601_date (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date, i.e. takes the complete form:

  • YYYY-MM-DD (extended, preferred) or one of the partial forms YYYY-MM or YYYY

  • YYYYMMDD (compact) or a partial variant YYYYMM.

Where:

  • YYYY is the string form of any positive number in the range 0000 - 9999 (zero-filled to four digits)

  • MM is 01 - 12 (zero-filled to two digits)

  • DD is 01 - 31 (zero-filled to two digits)

The combinations of YYYY, MM, DD numbers must be correct with respect to the Gregorian calendar.
Inherited from Time_Definitions

valid_iso8601_time (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date, i.e. takes the form:

  • hh:mm:ss[(,|.)s+][Z|±hh[:mm]] (extended)

  • hhmmss[(,|.)s+][Z|±hh[mm]] (compact)

  • or one of the partial forms:

    • hh:mm (extended)

    • hhmm or hh (compact)

with an additional optional timezone indicator of:

  • Z or`±hh[:mm]` (extended) ±hh[mm] (compact)

Where:

  • hh is "00" - "23" (0-filled to two digits)

  • mm is "00" - "59" (0-filled to two digits)

  • ss is "00" - "60" (0-filled to two digits)

  • [(,|.)s+] is an optional string consisting of a comma or decimal point followed by numeric string of 1 or more digits, representing a fractional second

  • Z is a literal meaning UTC (modern replacement for GMT), i.e. timezone +0000
    Inherited from Time_Definitions

valid_iso8601_date_time (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date-time, i.e. takes the form:

  • YYYY-MM-DDThh:mm:ss[(,|.)s+][Z|±hh[:mm]] (extended)

  • YYYYMMDDThhmmss[(,|.)s+][Z|±hh[mm]] (compact)

  • or one of the partial forms:

    • YYYY-MM-DDThh:mm or YYYY-MM-DDThh (extended)

    • YYYYMMDDThhmm or YYYYMMDDThh (compact)
      Inherited from Time_Definitions

valid_iso8601_duration (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 duration, i.e. takes the form:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Where each nn represents a number of years, months, etc. nnW represents a number of 7-day weeks.

Note: allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).
Inherited from Time_Definitions

Parameters
s

String is a valid ISO 8601 duration, i.e. takes the form:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Where each nn represents a number of years, months, etc. nnW represents a number of 7- day weeks.

allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).

(abstract) is_partial (): Boolean [1..1]

True if this date time is partial, i.e. if trailing end (right hand) value(s) is/are missing.

(abstract) is_extended (): Boolean [1..1]

True if this ISO8601 string is in the 'extended' form, i.e. uses ‘-’ and / or ‘:’ separators. This is the preferred format.

{
    "name": "Iso8601_type",
    "documentation": "Abstract ancestor type of ISO 8601 types, defining interface for 'extended' and 'partial' concepts from ISO 8601.",
    "is_abstract": true,
    "ancestors": [
        "Temporal",
        "Time_Definitions"
    ],
    "properties": {
        "value": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "value",
            "documentation": "Representation of all descendants is a single String.",
            "is_mandatory": true,
            "type": "String"
        }
    },
    "functions": {
        "is_partial": {
            "name": "is_partial",
            "documentation": "True if this date time is partial, i.e. if trailing end (right hand) value(s) is/are missing.",
            "is_abstract": true,
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_extended": {
            "name": "is_extended",
            "documentation": "True if this ISO8601 string is in the 'extended' form, i.e. uses ‘-’ and / or ‘:’ separators. This is the preferred format.",
            "is_abstract": true,
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        }
    }
}
iso8601 type

Iso8601_date Class

  • Definition

  • Effective

  • BMM

  • UML

Class

Iso8601_date

Description

Represents an ISO 8601 date, including partial and extended forms. Value may be:

  • YYYY-MM-DD (extended, preferred)

  • YYYYMMDD (compactd)

  • a partial invariant.

See Time_definitions.valid_iso8601_date() for validity.

Inherit

Iso8601_type

Functions

Signature

Meaning

1..1

year (): Integer

Year.

1..1

month (): Integer

Pre: not month_unknown

Month in year.

1..1

day (): Integer

Pre: not day_unknown

Day in month.

1..1

timezone (): Iso8601_timezone

Timezone; may be Void.

1..1

month_unknown (): Boolean

Indicates whether month in year is unknown. If so, the date is of the form "YYYY".

1..1

day_unknown (): Boolean

Indicates whether day in month is unknown. If so, and month is known, the date is of the form "YYYY-MM" or "YYYYMM".

1..1
(effected)

is_partial (): Boolean

True if this date is partial, i.e. if days or more is missing.

1..1
(effected)

is_extended (): Boolean

True if this date uses '-' separators.

1..1

as_string (): String

Return string value in extended format.

Invariants

Year_valid: valid_year (year)

Month_valid: not month_unknown implies valid_month (month)

Day_valid: not day_unknown implies valid_day (year, month, day)

Partial_validity: month_unknown implies day_unknown

Iso8601_date

Represents an ISO 8601 date, including partial and extended forms. Value may be:

  • YYYY-MM-DD (extended, preferred)

  • YYYYMMDD (compactd)

  • a partial invariant.

See Time_definitions.valid_iso8601_date() for validity.

Inherits: Any, Ordered, Temporal, Time_Definitions, Iso8601_type

Constants

Seconds_in_minute: Integer = 60 [1..1]

+ Inherited from Time_Definitions

Minutes_in_hour: Integer = 60 [1..1]

+ Inherited from Time_Definitions

Hours_in_day: Integer = 24 [1..1]

+ Inherited from Time_Definitions

Nominal_days_in_month: Real = 30.42 [1..1]

Used for conversions of durations containing months to days and / or seconds.
Inherited from Time_Definitions

Max_days_in_month: Integer = 31 [1..1]

+ Inherited from Time_Definitions

Days_in_year: Integer = 365 [1..1]

+ Inherited from Time_Definitions

Days_in_leap_year: Integer = 366 [1..1]

+ Inherited from Time_Definitions

Max_days_in_year: Integer = Days_in_leap_year [1..1]

+ Inherited from Time_Definitions

Nominal_days_in_year: Real = 365.24 [1..1]

Used for conversions of durations containing years to days and / or seconds.
Inherited from Time_Definitions

Days_in_week: Integer = 7 [1..1]

+ Inherited from Time_Definitions

Months_in_year: Integer = 12 [1..1]

+ Inherited from Time_Definitions

Min_timezone_hour: Integer = 12 [1..1]

Minimum hour value of a timezone (note that the -ve sign is supplied in the ISO8601_TIMEZONE class).
Inherited from Time_Definitions

Max_timezone_hour: Integer = 13 [1..1]

+ Inherited from Time_Definitions

Attributes

value: String [1..1]

Representation of all descendants is a single String.
Inherited from Iso8601_type

Functions

(abstract) is_equal (
other: Any[1]
): Boolean [1..1]

Value equality.
Inherited from Any

infix = (
other: Any[1]
): Boolean [1..1]

Reference equality.
Inherited from Any

Parameters
other

Reference equality.

instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.
Inherited from Any

type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".
Inherited from Any

(abstract) infix < (
other: Ordered[1]
): Boolean [1..1]

Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability.
Inherited from Ordered

valid_year (
y: Integer[1]
): Boolean

Post: Result = y >= 0 [1..1]

+ Inherited from Time_Definitions

valid_month (
m: Integer[1]
): Boolean

Post: Result = m >= 1 and m <= Months_in_year [1..1]

+ Inherited from Time_Definitions

valid_day (
y: Integer[1],
m: Integer[1],
d: Integer[1]
): Boolean

Post: Result = d >= 1 and d <= days_in_month (m, y) [1..1]

True if d >= 1 and d <= days_in_month (m, y)
Inherited from Time_Definitions

valid_hour (
h: Integer[1],
m: Integer[1],
s: Integer[1]
): Boolean

Post: Result = (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0) [1..1]

True if (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0)
Inherited from Time_Definitions

valid_minute (
m: Integer[1]
): Boolean

Post: Result = m >= 0 and m < Minutes_in_hour [1..1]

True if m >= 0 and m < Minutes_in_hour.
Inherited from Time_Definitions

valid_second (
s: Integer[1]
): Boolean

Post: Result = s >= 0 and s < Seconds_in_minute [1..1]

True if s >= 0 and s < Seconds_in_minute .
Inherited from Time_Definitions

valid_fractional_second (
fs: Double[1]
): Boolean

Post: Result = fs >= 0.0 and fs < 1.0 . [1..1]

True if fs >= 0.0 and fs < 1.0 .
Inherited from Time_Definitions

valid_iso8601_date (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date, i.e. takes the complete form:

  • YYYY-MM-DD (extended, preferred) or one of the partial forms YYYY-MM or YYYY

  • YYYYMMDD (compact) or a partial variant YYYYMM.

Where:

  • YYYY is the string form of any positive number in the range 0000 - 9999 (zero-filled to four digits)

  • MM is 01 - 12 (zero-filled to two digits)

  • DD is 01 - 31 (zero-filled to two digits)

The combinations of YYYY, MM, DD numbers must be correct with respect to the Gregorian calendar.
Inherited from Time_Definitions

valid_iso8601_time (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date, i.e. takes the form:

  • hh:mm:ss[(,|.)s+][Z|±hh[:mm]] (extended)

  • hhmmss[(,|.)s+][Z|±hh[mm]] (compact)

  • or one of the partial forms:

    • hh:mm (extended)

    • hhmm or hh (compact)

with an additional optional timezone indicator of:

  • Z or`±hh[:mm]` (extended) ±hh[mm] (compact)

Where:

  • hh is "00" - "23" (0-filled to two digits)

  • mm is "00" - "59" (0-filled to two digits)

  • ss is "00" - "60" (0-filled to two digits)

  • [(,|.)s+] is an optional string consisting of a comma or decimal point followed by numeric string of 1 or more digits, representing a fractional second

  • Z is a literal meaning UTC (modern replacement for GMT), i.e. timezone +0000
    Inherited from Time_Definitions

valid_iso8601_date_time (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date-time, i.e. takes the form:

  • YYYY-MM-DDThh:mm:ss[(,|.)s+][Z|±hh[:mm]] (extended)

  • YYYYMMDDThhmmss[(,|.)s+][Z|±hh[mm]] (compact)

  • or one of the partial forms:

    • YYYY-MM-DDThh:mm or YYYY-MM-DDThh (extended)

    • YYYYMMDDThhmm or YYYYMMDDThh (compact)
      Inherited from Time_Definitions

valid_iso8601_duration (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 duration, i.e. takes the form:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Where each nn represents a number of years, months, etc. nnW represents a number of 7-day weeks.

Note: allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).
Inherited from Time_Definitions

Parameters
s

String is a valid ISO 8601 duration, i.e. takes the form:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Where each nn represents a number of years, months, etc. nnW represents a number of 7- day weeks.

allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).

is_partial (): Boolean [1..1]

True if this date is partial, i.e. if days or more is missing.

is_extended (): Boolean [1..1]

True if this date uses '-' separators.

year (): Integer [1..1]

Year.

month (): Integer

Pre: not month_unknown [1..1]

Month in year.

day (): Integer

Pre: not day_unknown [1..1]

Day in month.

timezone (): Iso8601_timezone [1..1]

Timezone; may be Void.

month_unknown (): Boolean [1..1]

Indicates whether month in year is unknown. If so, the date is of the form "YYYY".

day_unknown (): Boolean [1..1]

Indicates whether day in month is unknown. If so, and month is known, the date is of the form "YYYY-MM" or "YYYYMM".

as_string (): String [1..1]

Return string value in extended format.

Invariants

Year_valid: valid_year (year)

Month_valid: not month_unknown implies valid_month (month)

Day_valid: not day_unknown implies valid_day (year, month, day)

Partial_validity: month_unknown implies day_unknown

{
    "name": "Iso8601_date",
    "documentation": "Represents an ISO 8601 date, including partial and extended forms. Value may be:\n\n* `YYYY-MM-DD` (extended, preferred)\n* `YYYYMMDD` (compactd)\n* a partial invariant.\n\nSee `Time_definitions._valid_iso8601_date()_` for validity.",
    "ancestors": [
        "Iso8601_type"
    ],
    "functions": {
        "year": {
            "name": "year",
            "documentation": "Year.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "month": {
            "name": "month",
            "documentation": "Month in year.",
            "pre_conditions": {
                "Pre": "not month_unknown"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "day": {
            "name": "day",
            "documentation": "Day in month.",
            "pre_conditions": {
                "Pre": "not day_unknown"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "timezone": {
            "name": "timezone",
            "documentation": "Timezone; may be Void.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Iso8601_timezone"
            }
        },
        "month_unknown": {
            "name": "month_unknown",
            "documentation": "Indicates whether month in year is unknown. If so, the date is of the form `\"YYYY\"`.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "day_unknown": {
            "name": "day_unknown",
            "documentation": "Indicates whether day in month is unknown. If so, and month is known, the date is of the form `\"YYYY-MM\"` or `\"YYYYMM\"`.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_partial": {
            "name": "is_partial",
            "documentation": "True if this date is partial, i.e. if days or more is missing.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_extended": {
            "name": "is_extended",
            "documentation": "True if this date uses `'-'` separators.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "as_string": {
            "name": "as_string",
            "documentation": "Return string value in extended format.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "String"
            }
        }
    },
    "invariants": {
        "Year_valid": "valid_year (year)",
        "Month_valid": "not month_unknown implies valid_month (month)",
        "Day_valid": "not day_unknown implies valid_day (year, month, day)",
        "Partial_validity": "month_unknown implies day_unknown"
    }
}
iso8601 date

Iso8601_time Class

  • Definition

  • Effective

  • BMM

  • UML

Class

Iso8601_time

Description

Represents an ISO 8601 time, including partial and extended forms. Value may be:

  • hh:mm:ss[,sss][Z|±hh[mm]] (extended, preferred) or

  • hhmmss[,sss][Z|±hh[mm]] (compact)

  • or a partial invariant.

See valid_iso8601_time() for validity.

A small deviation to the ISO 8601:2004 standard in this class is that the time 24:00:00 is not allowed, for consistency with Iso8601_date_time.

Inherit

Iso8601_type

Functions

Signature

Meaning

1..1

hour (): Integer

Hour in day, in 24-hour time.

1..1

minute (): Integer

Minute in hour.

1..1

second (): Integer

Second in minute.

1..1

fractional_second (): Real

Pre: not second_unknown

Fractional seconds.

1..1

timezone (): Iso8601_timezone

Timezone; may be Void.

1..1

minute_unknown (): Boolean

Indicates whether minute is unknown. If so, the time is of the form “hh”.

1..1

second_unknown (): Boolean

Indicates whether second is unknown. If so and month is known, the time is of the form "hh:mm" or "hhmm".

1..1

is_decimal_sign_comma (): Boolean

True if this time has a decimal part indicated by ‘,’ (comma) rather than ‘.’ (period).

1..1
(effected)

is_partial (): Boolean

True if this time is partial, i.e. if seconds or more is missing.

1..1
(effected)

is_extended (): Boolean

True if this time uses ‘-’, ‘:’ separators.

1..1

has_fractional_second (): Boolean

True if the fractional_second part is signficant (i.e. even if = 0.0).

1..1

as_string (): String

Return string value in extended format.

Invariants

Hour_valid: valid_hour(hour, minute, second)

Minute_valid: not minute_unknown implies valid_minute (minute)

Second_valid: not second_unknown implies valid_second (second)

Fractional_second_valid: has_fractional_second implies (not second_unknown and valid_fractional_second (fractional_second))

Partial_validity: minute_unknown implies second_unknown

Iso8601_time

Represents an ISO 8601 time, including partial and extended forms. Value may be:

  • hh:mm:ss[,sss][Z|±hh[mm]] (extended, preferred) or

  • hhmmss[,sss][Z|±hh[mm]] (compact)

  • or a partial invariant.

See valid_iso8601_time() for validity.

A small deviation to the ISO 8601:2004 standard in this class is that the time 24:00:00 is not allowed, for consistency with Iso8601_date_time.

Inherits: Any, Ordered, Temporal, Time_Definitions, Iso8601_type

Constants

Seconds_in_minute: Integer = 60 [1..1]

+ Inherited from Time_Definitions

Minutes_in_hour: Integer = 60 [1..1]

+ Inherited from Time_Definitions

Hours_in_day: Integer = 24 [1..1]

+ Inherited from Time_Definitions

Nominal_days_in_month: Real = 30.42 [1..1]

Used for conversions of durations containing months to days and / or seconds.
Inherited from Time_Definitions

Max_days_in_month: Integer = 31 [1..1]

+ Inherited from Time_Definitions

Days_in_year: Integer = 365 [1..1]

+ Inherited from Time_Definitions

Days_in_leap_year: Integer = 366 [1..1]

+ Inherited from Time_Definitions

Max_days_in_year: Integer = Days_in_leap_year [1..1]

+ Inherited from Time_Definitions

Nominal_days_in_year: Real = 365.24 [1..1]

Used for conversions of durations containing years to days and / or seconds.
Inherited from Time_Definitions

Days_in_week: Integer = 7 [1..1]

+ Inherited from Time_Definitions

Months_in_year: Integer = 12 [1..1]

+ Inherited from Time_Definitions

Min_timezone_hour: Integer = 12 [1..1]

Minimum hour value of a timezone (note that the -ve sign is supplied in the ISO8601_TIMEZONE class).
Inherited from Time_Definitions

Max_timezone_hour: Integer = 13 [1..1]

+ Inherited from Time_Definitions

Attributes

value: String [1..1]

Representation of all descendants is a single String.
Inherited from Iso8601_type

Functions

(abstract) is_equal (
other: Any[1]
): Boolean [1..1]

Value equality.
Inherited from Any

infix = (
other: Any[1]
): Boolean [1..1]

Reference equality.
Inherited from Any

Parameters
other

Reference equality.

instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.
Inherited from Any

type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".
Inherited from Any

(abstract) infix < (
other: Ordered[1]
): Boolean [1..1]

Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability.
Inherited from Ordered

valid_year (
y: Integer[1]
): Boolean

Post: Result = y >= 0 [1..1]

+ Inherited from Time_Definitions

valid_month (
m: Integer[1]
): Boolean

Post: Result = m >= 1 and m <= Months_in_year [1..1]

+ Inherited from Time_Definitions

valid_day (
y: Integer[1],
m: Integer[1],
d: Integer[1]
): Boolean

Post: Result = d >= 1 and d <= days_in_month (m, y) [1..1]

True if d >= 1 and d <= days_in_month (m, y)
Inherited from Time_Definitions

valid_hour (
h: Integer[1],
m: Integer[1],
s: Integer[1]
): Boolean

Post: Result = (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0) [1..1]

True if (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0)
Inherited from Time_Definitions

valid_minute (
m: Integer[1]
): Boolean

Post: Result = m >= 0 and m < Minutes_in_hour [1..1]

True if m >= 0 and m < Minutes_in_hour.
Inherited from Time_Definitions

valid_second (
s: Integer[1]
): Boolean

Post: Result = s >= 0 and s < Seconds_in_minute [1..1]

True if s >= 0 and s < Seconds_in_minute .
Inherited from Time_Definitions

valid_fractional_second (
fs: Double[1]
): Boolean

Post: Result = fs >= 0.0 and fs < 1.0 . [1..1]

True if fs >= 0.0 and fs < 1.0 .
Inherited from Time_Definitions

valid_iso8601_date (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date, i.e. takes the complete form:

  • YYYY-MM-DD (extended, preferred) or one of the partial forms YYYY-MM or YYYY

  • YYYYMMDD (compact) or a partial variant YYYYMM.

Where:

  • YYYY is the string form of any positive number in the range 0000 - 9999 (zero-filled to four digits)

  • MM is 01 - 12 (zero-filled to two digits)

  • DD is 01 - 31 (zero-filled to two digits)

The combinations of YYYY, MM, DD numbers must be correct with respect to the Gregorian calendar.
Inherited from Time_Definitions

valid_iso8601_time (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date, i.e. takes the form:

  • hh:mm:ss[(,|.)s+][Z|±hh[:mm]] (extended)

  • hhmmss[(,|.)s+][Z|±hh[mm]] (compact)

  • or one of the partial forms:

    • hh:mm (extended)

    • hhmm or hh (compact)

with an additional optional timezone indicator of:

  • Z or`±hh[:mm]` (extended) ±hh[mm] (compact)

Where:

  • hh is "00" - "23" (0-filled to two digits)

  • mm is "00" - "59" (0-filled to two digits)

  • ss is "00" - "60" (0-filled to two digits)

  • [(,|.)s+] is an optional string consisting of a comma or decimal point followed by numeric string of 1 or more digits, representing a fractional second

  • Z is a literal meaning UTC (modern replacement for GMT), i.e. timezone +0000
    Inherited from Time_Definitions

valid_iso8601_date_time (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date-time, i.e. takes the form:

  • YYYY-MM-DDThh:mm:ss[(,|.)s+][Z|±hh[:mm]] (extended)

  • YYYYMMDDThhmmss[(,|.)s+][Z|±hh[mm]] (compact)

  • or one of the partial forms:

    • YYYY-MM-DDThh:mm or YYYY-MM-DDThh (extended)

    • YYYYMMDDThhmm or YYYYMMDDThh (compact)
      Inherited from Time_Definitions

valid_iso8601_duration (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 duration, i.e. takes the form:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Where each nn represents a number of years, months, etc. nnW represents a number of 7-day weeks.

Note: allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).
Inherited from Time_Definitions

Parameters
s

String is a valid ISO 8601 duration, i.e. takes the form:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Where each nn represents a number of years, months, etc. nnW represents a number of 7- day weeks.

allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).

is_partial (): Boolean [1..1]

True if this time is partial, i.e. if seconds or more is missing.

is_extended (): Boolean [1..1]

True if this time uses ‘-’, ‘:’ separators.

hour (): Integer [1..1]

Hour in day, in 24-hour time.

minute (): Integer [1..1]

Minute in hour.

second (): Integer [1..1]

Second in minute.

fractional_second (): Real

Pre: not second_unknown [1..1]

Fractional seconds.

timezone (): Iso8601_timezone [1..1]

Timezone; may be Void.

minute_unknown (): Boolean [1..1]

Indicates whether minute is unknown. If so, the time is of the form “hh”.

second_unknown (): Boolean [1..1]

Indicates whether second is unknown. If so and month is known, the time is of the form "hh:mm" or "hhmm".

is_decimal_sign_comma (): Boolean [1..1]

True if this time has a decimal part indicated by ‘,’ (comma) rather than ‘.’ (period).

has_fractional_second (): Boolean [1..1]

True if the fractional_second part is signficant (i.e. even if = 0.0).

as_string (): String [1..1]

Return string value in extended format.

Invariants

Hour_valid: valid_hour(hour, minute, second)

Minute_valid: not minute_unknown implies valid_minute (minute)

Second_valid: not second_unknown implies valid_second (second)

Fractional_second_valid: has_fractional_second implies (not second_unknown and valid_fractional_second (fractional_second))

Partial_validity: minute_unknown implies second_unknown

{
    "name": "Iso8601_time",
    "documentation": "Represents an ISO 8601 time, including partial and extended forms. Value may be:\n\n* `hh:mm:ss[,sss][Z|±hh[mm]]` (extended, preferred) or\n* `hhmmss[,sss][Z|±hh[mm]]` (compact)\n* or a partial invariant.\n\nSee `_valid_iso8601_time()_` for validity.\n\nNOTE: A small deviation to the ISO 8601:2004 standard in this class is that the time `24:00:00` is not allowed, for consistency with `Iso8601_date_time`.",
    "ancestors": [
        "Iso8601_type"
    ],
    "functions": {
        "hour": {
            "name": "hour",
            "documentation": "Hour in day, in 24-hour time.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "minute": {
            "name": "minute",
            "documentation": "Minute in hour.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "second": {
            "name": "second",
            "documentation": "Second in minute.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "fractional_second": {
            "name": "fractional_second",
            "documentation": "Fractional seconds.",
            "pre_conditions": {
                "Pre": "not second_unknown"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Real"
            }
        },
        "timezone": {
            "name": "timezone",
            "documentation": "Timezone; may be Void.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Iso8601_timezone"
            }
        },
        "minute_unknown": {
            "name": "minute_unknown",
            "documentation": "Indicates whether minute is unknown. If so, the time is of the form “hh”.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "second_unknown": {
            "name": "second_unknown",
            "documentation": "Indicates whether second is unknown. If so and month is known, the time is of the form `\"hh:mm\"` or `\"hhmm\"`.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_decimal_sign_comma": {
            "name": "is_decimal_sign_comma",
            "documentation": "True if this time has a decimal part indicated by ‘,’ (comma) rather than ‘.’ (period).",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_partial": {
            "name": "is_partial",
            "documentation": "True if this time is partial, i.e. if seconds or more is missing.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_extended": {
            "name": "is_extended",
            "documentation": "True if this time uses ‘-’, ‘:’ separators.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "has_fractional_second": {
            "name": "has_fractional_second",
            "documentation": "True if the fractional_second part is signficant (i.e. even if = 0.0).",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "as_string": {
            "name": "as_string",
            "documentation": "Return string value in extended format.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "String"
            }
        }
    },
    "invariants": {
        "Hour_valid": "valid_hour(hour, minute, second)",
        "Minute_valid": "not minute_unknown implies valid_minute (minute)",
        "Second_valid": "not second_unknown implies valid_second (second)",
        "Fractional_second_valid": "has_fractional_second implies (not second_unknown and valid_fractional_second (fractional_second))",
        "Partial_validity": "minute_unknown implies second_unknown"
    }
}
iso8601 time

Iso8601_date_time Class

  • Definition

  • Effective

  • BMM

  • UML

Class

Iso8601_date_time

Description

Represents an ISO 8601 date/time, including partial and extended forms. Value may be:

  • YYYY-MM-DDThh:mm:ss[,sss][Z | ±hh[mm]] (extended, preferred) or

  • YYYYMMDDThhmmss[,sss][Z | ±hh[mm]] (compact)

  • or a partial variant.

See valid_iso8601_date_time() for validity.

Note that this class includes 2 deviations from ISO 8601:2004:

  • for partial date/times, any part of the date/time up to the month may be missing, not just seconds and minutes as in the standard;

  • the time 24:00:00 is not allowed, since it would mean the date was really on the next day.

Inherit

Iso8601_type

Functions

Signature

Meaning

1..1

year (): Integer

Year.

1..1

month (): Integer

Pre: not month_unknown

Month in year.

1..1

day (): Integer

Pre: not day_unknown

Day in month.

1..1

hour (): Integer

Pre: not hour_unknown

Hour in day.

1..1

minute (): Integer

Pre: not minute_unknown

Minute in hour.

1..1

second (): Integer

Pre: not second_unknown

Second in minute.

1..1

fractional_second (): Real

Fractional seconds.

1..1

timezone (): Iso8601_timezone

Timezone; may be Void.

1..1

month_unknown (): Boolean

Indicates whether month in year is unknown.

1..1

day_unknown (): Boolean

Indicates whether day in month is unknown.

1..1

minute_unknown (): Boolean

Indicates whether minute in hour is known.

1..1

second_unknown (): Boolean

Indicates whether minute in hour is known.

1..1

is_decimal_sign_comma (): Boolean

True if this time has a decimal part indicated by ‘,’ (comma) rather than ‘.’ (period).

1..1
(effected)

is_partial (): Boolean

True if this date time is partial, i.e. if seconds or more is missing.

1..1
(effected)

is_extended (): Boolean

True if this date/time uses ‘-’, ‘:’ separators.

1..1

has_fractional_second (): Boolean

True if the fractional_second part is signficant (i.e. even if = 0.0).

1..1

as_string (): String

Return the string value in extended format.

Invariants

Year_valid: valid_year (year)

Month_valid: valid_month (month)

Day_valid: valid_day(year, month, day)

Hour_valid: valid_hour (hour, minute, second)

Minute_valid: not minute_unknown implies valid_minute(minute)

Second_valid: not second_unknown implies valid_second (second)

Fractional_second_valid: has_fractional_second implies (not second_unknown and valid_fractional_second (fractional_second))

Partial_validity_year: not month_unknown

Partial_validity_month: not month_unknown

Partial_validity_day: not day_unknown

Partial_validity_hour: not hour_unknown

Partial_validity_minute: minute_unknown implies second_unknown

Iso8601_date_time

Represents an ISO 8601 date/time, including partial and extended forms. Value may be:

  • YYYY-MM-DDThh:mm:ss[,sss][Z | ±hh[mm]] (extended, preferred) or

  • YYYYMMDDThhmmss[,sss][Z | ±hh[mm]] (compact)

  • or a partial variant.

See valid_iso8601_date_time() for validity.

Note that this class includes 2 deviations from ISO 8601:2004:

  • for partial date/times, any part of the date/time up to the month may be missing, not just seconds and minutes as in the standard;

  • the time 24:00:00 is not allowed, since it would mean the date was really on the next day.

Inherits: Any, Ordered, Temporal, Time_Definitions, Iso8601_type

Constants

Seconds_in_minute: Integer = 60 [1..1]

+ Inherited from Time_Definitions

Minutes_in_hour: Integer = 60 [1..1]

+ Inherited from Time_Definitions

Hours_in_day: Integer = 24 [1..1]

+ Inherited from Time_Definitions

Nominal_days_in_month: Real = 30.42 [1..1]

Used for conversions of durations containing months to days and / or seconds.
Inherited from Time_Definitions

Max_days_in_month: Integer = 31 [1..1]

+ Inherited from Time_Definitions

Days_in_year: Integer = 365 [1..1]

+ Inherited from Time_Definitions

Days_in_leap_year: Integer = 366 [1..1]

+ Inherited from Time_Definitions

Max_days_in_year: Integer = Days_in_leap_year [1..1]

+ Inherited from Time_Definitions

Nominal_days_in_year: Real = 365.24 [1..1]

Used for conversions of durations containing years to days and / or seconds.
Inherited from Time_Definitions

Days_in_week: Integer = 7 [1..1]

+ Inherited from Time_Definitions

Months_in_year: Integer = 12 [1..1]

+ Inherited from Time_Definitions

Min_timezone_hour: Integer = 12 [1..1]

Minimum hour value of a timezone (note that the -ve sign is supplied in the ISO8601_TIMEZONE class).
Inherited from Time_Definitions

Max_timezone_hour: Integer = 13 [1..1]

+ Inherited from Time_Definitions

Attributes

value: String [1..1]

Representation of all descendants is a single String.
Inherited from Iso8601_type

Functions

(abstract) is_equal (
other: Any[1]
): Boolean [1..1]

Value equality.
Inherited from Any

infix = (
other: Any[1]
): Boolean [1..1]

Reference equality.
Inherited from Any

Parameters
other

Reference equality.

instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.
Inherited from Any

type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".
Inherited from Any

(abstract) infix < (
other: Ordered[1]
): Boolean [1..1]

Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability.
Inherited from Ordered

valid_year (
y: Integer[1]
): Boolean

Post: Result = y >= 0 [1..1]

+ Inherited from Time_Definitions

valid_month (
m: Integer[1]
): Boolean

Post: Result = m >= 1 and m <= Months_in_year [1..1]

+ Inherited from Time_Definitions

valid_day (
y: Integer[1],
m: Integer[1],
d: Integer[1]
): Boolean

Post: Result = d >= 1 and d <= days_in_month (m, y) [1..1]

True if d >= 1 and d <= days_in_month (m, y)
Inherited from Time_Definitions

valid_hour (
h: Integer[1],
m: Integer[1],
s: Integer[1]
): Boolean

Post: Result = (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0) [1..1]

True if (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0)
Inherited from Time_Definitions

valid_minute (
m: Integer[1]
): Boolean

Post: Result = m >= 0 and m < Minutes_in_hour [1..1]

True if m >= 0 and m < Minutes_in_hour.
Inherited from Time_Definitions

valid_second (
s: Integer[1]
): Boolean

Post: Result = s >= 0 and s < Seconds_in_minute [1..1]

True if s >= 0 and s < Seconds_in_minute .
Inherited from Time_Definitions

valid_fractional_second (
fs: Double[1]
): Boolean

Post: Result = fs >= 0.0 and fs < 1.0 . [1..1]

True if fs >= 0.0 and fs < 1.0 .
Inherited from Time_Definitions

valid_iso8601_date (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date, i.e. takes the complete form:

  • YYYY-MM-DD (extended, preferred) or one of the partial forms YYYY-MM or YYYY

  • YYYYMMDD (compact) or a partial variant YYYYMM.

Where:

  • YYYY is the string form of any positive number in the range 0000 - 9999 (zero-filled to four digits)

  • MM is 01 - 12 (zero-filled to two digits)

  • DD is 01 - 31 (zero-filled to two digits)

The combinations of YYYY, MM, DD numbers must be correct with respect to the Gregorian calendar.
Inherited from Time_Definitions

valid_iso8601_time (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date, i.e. takes the form:

  • hh:mm:ss[(,|.)s+][Z|±hh[:mm]] (extended)

  • hhmmss[(,|.)s+][Z|±hh[mm]] (compact)

  • or one of the partial forms:

    • hh:mm (extended)

    • hhmm or hh (compact)

with an additional optional timezone indicator of:

  • Z or`±hh[:mm]` (extended) ±hh[mm] (compact)

Where:

  • hh is "00" - "23" (0-filled to two digits)

  • mm is "00" - "59" (0-filled to two digits)

  • ss is "00" - "60" (0-filled to two digits)

  • [(,|.)s+] is an optional string consisting of a comma or decimal point followed by numeric string of 1 or more digits, representing a fractional second

  • Z is a literal meaning UTC (modern replacement for GMT), i.e. timezone +0000
    Inherited from Time_Definitions

valid_iso8601_date_time (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date-time, i.e. takes the form:

  • YYYY-MM-DDThh:mm:ss[(,|.)s+][Z|±hh[:mm]] (extended)

  • YYYYMMDDThhmmss[(,|.)s+][Z|±hh[mm]] (compact)

  • or one of the partial forms:

    • YYYY-MM-DDThh:mm or YYYY-MM-DDThh (extended)

    • YYYYMMDDThhmm or YYYYMMDDThh (compact)
      Inherited from Time_Definitions

valid_iso8601_duration (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 duration, i.e. takes the form:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Where each nn represents a number of years, months, etc. nnW represents a number of 7-day weeks.

Note: allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).
Inherited from Time_Definitions

Parameters
s

String is a valid ISO 8601 duration, i.e. takes the form:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Where each nn represents a number of years, months, etc. nnW represents a number of 7- day weeks.

allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).

is_partial (): Boolean [1..1]

True if this date time is partial, i.e. if seconds or more is missing.

is_extended (): Boolean [1..1]

True if this date/time uses ‘-’, ‘:’ separators.

year (): Integer [1..1]

Year.

month (): Integer

Pre: not month_unknown [1..1]

Month in year.

day (): Integer

Pre: not day_unknown [1..1]

Day in month.

hour (): Integer

Pre: not hour_unknown [1..1]

Hour in day.

minute (): Integer

Pre: not minute_unknown [1..1]

Minute in hour.

second (): Integer

Pre: not second_unknown [1..1]

Second in minute.

fractional_second (): Real [1..1]

Fractional seconds.

timezone (): Iso8601_timezone [1..1]

Timezone; may be Void.

month_unknown (): Boolean [1..1]

Indicates whether month in year is unknown.

day_unknown (): Boolean [1..1]

Indicates whether day in month is unknown.

minute_unknown (): Boolean [1..1]

Indicates whether minute in hour is known.

second_unknown (): Boolean [1..1]

Indicates whether minute in hour is known.

is_decimal_sign_comma (): Boolean [1..1]

True if this time has a decimal part indicated by ‘,’ (comma) rather than ‘.’ (period).

has_fractional_second (): Boolean [1..1]

True if the fractional_second part is signficant (i.e. even if = 0.0).

as_string (): String [1..1]

Return the string value in extended format.

Invariants

Year_valid: valid_year (year)

Month_valid: valid_month (month)

Day_valid: valid_day(year, month, day)

Hour_valid: valid_hour (hour, minute, second)

Minute_valid: not minute_unknown implies valid_minute(minute)

Second_valid: not second_unknown implies valid_second (second)

Fractional_second_valid: has_fractional_second implies (not second_unknown and valid_fractional_second (fractional_second))

Partial_validity_year: not month_unknown

Partial_validity_month: not month_unknown

Partial_validity_day: not day_unknown

Partial_validity_hour: not hour_unknown

Partial_validity_minute: minute_unknown implies second_unknown

{
    "name": "Iso8601_date_time",
    "documentation": "Represents an ISO 8601 date/time, including partial and extended forms. Value may be:\n\n* `YYYY-MM-DDThh:mm:ss[,sss][Z | ±hh[mm]]` (extended, preferred) or\n* `YYYYMMDDThhmmss[,sss][Z | ±hh[mm]]` (compact)\n* or a partial variant.\n\nSee `_valid_iso8601_date_time()_` for validity.\n\nNote that this class includes 2 deviations from ISO 8601:2004:\n\n* for partial date/times, any part of the date/time up to the month may be missing, not just seconds and minutes as in the standard;\n* the time `24:00:00` is not allowed, since it would mean the date was really on the next day.",
    "ancestors": [
        "Iso8601_type"
    ],
    "functions": {
        "year": {
            "name": "year",
            "documentation": "Year.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "month": {
            "name": "month",
            "documentation": "Month in year.",
            "pre_conditions": {
                "Pre": "not month_unknown"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "day": {
            "name": "day",
            "documentation": "Day in month.",
            "pre_conditions": {
                "Pre": "not day_unknown"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "hour": {
            "name": "hour",
            "documentation": "Hour in day.",
            "pre_conditions": {
                "Pre": "not hour_unknown"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "minute": {
            "name": "minute",
            "documentation": "Minute in hour.",
            "pre_conditions": {
                "Pre": "not minute_unknown"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "second": {
            "name": "second",
            "documentation": "Second in minute.",
            "pre_conditions": {
                "Pre": "not second_unknown"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "fractional_second": {
            "name": "fractional_second",
            "documentation": "Fractional seconds.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Real"
            }
        },
        "timezone": {
            "name": "timezone",
            "documentation": "Timezone; may be Void.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Iso8601_timezone"
            }
        },
        "month_unknown": {
            "name": "month_unknown",
            "documentation": "Indicates whether month in year is unknown.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "day_unknown": {
            "name": "day_unknown",
            "documentation": "Indicates whether day in month is unknown.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "minute_unknown": {
            "name": "minute_unknown",
            "documentation": "Indicates whether minute in hour is known.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "second_unknown": {
            "name": "second_unknown",
            "documentation": "Indicates whether minute in hour is known.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_decimal_sign_comma": {
            "name": "is_decimal_sign_comma",
            "documentation": "True if this time has a decimal part indicated by ‘,’ (comma) rather than ‘.’ (period).",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_partial": {
            "name": "is_partial",
            "documentation": "True if this date time is partial, i.e. if seconds or more is missing.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_extended": {
            "name": "is_extended",
            "documentation": "True if this date/time uses ‘-’, ‘:’ separators.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "has_fractional_second": {
            "name": "has_fractional_second",
            "documentation": "True if the fractional_second part is signficant (i.e. even if = 0.0).",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "as_string": {
            "name": "as_string",
            "documentation": "Return the string value in extended format.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "String"
            }
        }
    },
    "invariants": {
        "Year_valid": "valid_year (year)",
        "Month_valid": "valid_month (month)",
        "Day_valid": "valid_day(year, month, day)",
        "Hour_valid": "valid_hour (hour, minute, second)",
        "Minute_valid": "not minute_unknown implies valid_minute(minute)",
        "Second_valid": "not second_unknown implies valid_second (second)",
        "Fractional_second_valid": "has_fractional_second implies (not second_unknown and valid_fractional_second (fractional_second))",
        "Partial_validity_year": "not month_unknown",
        "Partial_validity_month": "not month_unknown",
        "Partial_validity_day": "not day_unknown",
        "Partial_validity_hour": "not hour_unknown",
        "Partial_validity_minute": "minute_unknown implies second_unknown"
    }
}
iso8601 date time

Iso8601_duration Class

  • Definition

  • Effective

  • BMM

  • UML

Class

Iso8601_duration

Description

Represents an ISO 8601 duration, which may have multiple parts from years down to seconds. Value is in format:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Inherit

Iso8601_type

Functions

Signature

Meaning

1..1

seconds (): Integer

Number of seconds.

1..1

fractional_seconds (): Real

Fractional seconds.

1..1

is_decimal_sign_comma (): Boolean

True if this time has a decimal part indicated by ',' (comma) rather than '.' (period).

1..1
(effected)

is_partial (): Boolean

Returns False.

1..1
(effected)

is_extended (): Boolean

Returns True.

1..1

months (): Integer

Number of months.

1..1

years (): Integer

Number of years of nominal 365-day length.

1..1

weeks (): Integer

Number of 7 day weeks.

1..1

to_seconds (): Real

Total number of seconds equivalent (including fractional) of entire duration.

1..1

minutes (): Integer

Number of 60 second minutes.

1..1

hours (): Integer

Number of 60 minute hours.

1..1

days (): Integer

Number of 24 hour days.

1..1

as_string (): String

Return the duration string value.

Invariants

Years_valid: years >= 0

Months_valid: months >= 0

Weeks_valid: weeks >= 0

Days_valid: days >= 0

Hours_valid: hours >= 0

Minutes_valid: minutes >= 0

Seconds_valid: seconds >= 0

Fractional_second_valid: fractional_second >= 0.0 and fractional_second < 1.0

Iso8601_duration

Represents an ISO 8601 duration, which may have multiple parts from years down to seconds. Value is in format:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Inherits: Any, Ordered, Temporal, Time_Definitions, Iso8601_type

Constants

Seconds_in_minute: Integer = 60 [1..1]

+ Inherited from Time_Definitions

Minutes_in_hour: Integer = 60 [1..1]

+ Inherited from Time_Definitions

Hours_in_day: Integer = 24 [1..1]

+ Inherited from Time_Definitions

Nominal_days_in_month: Real = 30.42 [1..1]

Used for conversions of durations containing months to days and / or seconds.
Inherited from Time_Definitions

Max_days_in_month: Integer = 31 [1..1]

+ Inherited from Time_Definitions

Days_in_year: Integer = 365 [1..1]

+ Inherited from Time_Definitions

Days_in_leap_year: Integer = 366 [1..1]

+ Inherited from Time_Definitions

Max_days_in_year: Integer = Days_in_leap_year [1..1]

+ Inherited from Time_Definitions

Nominal_days_in_year: Real = 365.24 [1..1]

Used for conversions of durations containing years to days and / or seconds.
Inherited from Time_Definitions

Days_in_week: Integer = 7 [1..1]

+ Inherited from Time_Definitions

Months_in_year: Integer = 12 [1..1]

+ Inherited from Time_Definitions

Min_timezone_hour: Integer = 12 [1..1]

Minimum hour value of a timezone (note that the -ve sign is supplied in the ISO8601_TIMEZONE class).
Inherited from Time_Definitions

Max_timezone_hour: Integer = 13 [1..1]

+ Inherited from Time_Definitions

Attributes

value: String [1..1]

Representation of all descendants is a single String.
Inherited from Iso8601_type

Functions

(abstract) is_equal (
other: Any[1]
): Boolean [1..1]

Value equality.
Inherited from Any

infix = (
other: Any[1]
): Boolean [1..1]

Reference equality.
Inherited from Any

Parameters
other

Reference equality.

instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.
Inherited from Any

type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".
Inherited from Any

(abstract) infix < (
other: Ordered[1]
): Boolean [1..1]

Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability.
Inherited from Ordered

valid_year (
y: Integer[1]
): Boolean

Post: Result = y >= 0 [1..1]

+ Inherited from Time_Definitions

valid_month (
m: Integer[1]
): Boolean

Post: Result = m >= 1 and m <= Months_in_year [1..1]

+ Inherited from Time_Definitions

valid_day (
y: Integer[1],
m: Integer[1],
d: Integer[1]
): Boolean

Post: Result = d >= 1 and d <= days_in_month (m, y) [1..1]

True if d >= 1 and d <= days_in_month (m, y)
Inherited from Time_Definitions

valid_hour (
h: Integer[1],
m: Integer[1],
s: Integer[1]
): Boolean

Post: Result = (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0) [1..1]

True if (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0)
Inherited from Time_Definitions

valid_minute (
m: Integer[1]
): Boolean

Post: Result = m >= 0 and m < Minutes_in_hour [1..1]

True if m >= 0 and m < Minutes_in_hour.
Inherited from Time_Definitions

valid_second (
s: Integer[1]
): Boolean

Post: Result = s >= 0 and s < Seconds_in_minute [1..1]

True if s >= 0 and s < Seconds_in_minute .
Inherited from Time_Definitions

valid_fractional_second (
fs: Double[1]
): Boolean

Post: Result = fs >= 0.0 and fs < 1.0 . [1..1]

True if fs >= 0.0 and fs < 1.0 .
Inherited from Time_Definitions

valid_iso8601_date (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date, i.e. takes the complete form:

  • YYYY-MM-DD (extended, preferred) or one of the partial forms YYYY-MM or YYYY

  • YYYYMMDD (compact) or a partial variant YYYYMM.

Where:

  • YYYY is the string form of any positive number in the range 0000 - 9999 (zero-filled to four digits)

  • MM is 01 - 12 (zero-filled to two digits)

  • DD is 01 - 31 (zero-filled to two digits)

The combinations of YYYY, MM, DD numbers must be correct with respect to the Gregorian calendar.
Inherited from Time_Definitions

valid_iso8601_time (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date, i.e. takes the form:

  • hh:mm:ss[(,|.)s+][Z|±hh[:mm]] (extended)

  • hhmmss[(,|.)s+][Z|±hh[mm]] (compact)

  • or one of the partial forms:

    • hh:mm (extended)

    • hhmm or hh (compact)

with an additional optional timezone indicator of:

  • Z or`±hh[:mm]` (extended) ±hh[mm] (compact)

Where:

  • hh is "00" - "23" (0-filled to two digits)

  • mm is "00" - "59" (0-filled to two digits)

  • ss is "00" - "60" (0-filled to two digits)

  • [(,|.)s+] is an optional string consisting of a comma or decimal point followed by numeric string of 1 or more digits, representing a fractional second

  • Z is a literal meaning UTC (modern replacement for GMT), i.e. timezone +0000
    Inherited from Time_Definitions

valid_iso8601_date_time (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date-time, i.e. takes the form:

  • YYYY-MM-DDThh:mm:ss[(,|.)s+][Z|±hh[:mm]] (extended)

  • YYYYMMDDThhmmss[(,|.)s+][Z|±hh[mm]] (compact)

  • or one of the partial forms:

    • YYYY-MM-DDThh:mm or YYYY-MM-DDThh (extended)

    • YYYYMMDDThhmm or YYYYMMDDThh (compact)
      Inherited from Time_Definitions

valid_iso8601_duration (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 duration, i.e. takes the form:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Where each nn represents a number of years, months, etc. nnW represents a number of 7-day weeks.

Note: allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).
Inherited from Time_Definitions

Parameters
s

String is a valid ISO 8601 duration, i.e. takes the form:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Where each nn represents a number of years, months, etc. nnW represents a number of 7- day weeks.

allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).

is_partial (): Boolean [1..1]

Returns False.

is_extended (): Boolean [1..1]

Returns True.

seconds (): Integer [1..1]

Number of seconds.

fractional_seconds (): Real [1..1]

Fractional seconds.

is_decimal_sign_comma (): Boolean [1..1]

True if this time has a decimal part indicated by ',' (comma) rather than '.' (period).

months (): Integer [1..1]

Number of months.

years (): Integer [1..1]

Number of years of nominal 365-day length.

weeks (): Integer [1..1]

Number of 7 day weeks.

to_seconds (): Real [1..1]

Total number of seconds equivalent (including fractional) of entire duration.

minutes (): Integer [1..1]

Number of 60 second minutes.

hours (): Integer [1..1]

Number of 60 minute hours.

days (): Integer [1..1]

Number of 24 hour days.

as_string (): String [1..1]

Return the duration string value.

Invariants

Years_valid: years >= 0

Months_valid: months >= 0

Weeks_valid: weeks >= 0

Days_valid: days >= 0

Hours_valid: hours >= 0

Minutes_valid: minutes >= 0

Seconds_valid: seconds >= 0

Fractional_second_valid: fractional_second >= 0.0 and fractional_second < 1.0

{
    "name": "Iso8601_duration",
    "documentation": "Represents an ISO 8601 duration, which may have multiple parts from years down to seconds. Value is in format:\n\n* `P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]`",
    "ancestors": [
        "Iso8601_type"
    ],
    "functions": {
        "seconds": {
            "name": "seconds",
            "documentation": "Number of seconds.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "fractional_seconds": {
            "name": "fractional_seconds",
            "documentation": "Fractional seconds.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Real"
            }
        },
        "is_decimal_sign_comma": {
            "name": "is_decimal_sign_comma",
            "documentation": "True if this time has a decimal part indicated by ',' (comma) rather than '.' (period).",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_partial": {
            "name": "is_partial",
            "documentation": "Returns False.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_extended": {
            "name": "is_extended",
            "documentation": "Returns True.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "months": {
            "name": "months",
            "documentation": "Number of months.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "years": {
            "name": "years",
            "documentation": "Number of years of nominal 365-day length.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "weeks": {
            "name": "weeks",
            "documentation": "Number of 7 day weeks.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "to_seconds": {
            "name": "to_seconds",
            "documentation": "Total number of seconds equivalent (including fractional) of entire duration.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Real"
            }
        },
        "minutes": {
            "name": "minutes",
            "documentation": "Number of 60 second minutes.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "hours": {
            "name": "hours",
            "documentation": "Number of 60 minute hours.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "days": {
            "name": "days",
            "documentation": "Number of 24 hour days.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "as_string": {
            "name": "as_string",
            "documentation": "Return the duration string value.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "String"
            }
        }
    },
    "invariants": {
        "Years_valid": "years >= 0",
        "Months_valid": "months >= 0",
        "Weeks_valid": "weeks >= 0",
        "Days_valid": "days >= 0",
        "Hours_valid": "hours >= 0",
        "Minutes_valid": "minutes >= 0",
        "Seconds_valid": "seconds >= 0",
        "Fractional_second_valid": "fractional_second >= 0.0 and fractional_second < 1.0"
    }
}
iso8601 duration

Iso8601_timezone Class

  • Definition

  • Effective

  • BMM

  • UML

Class

Iso8601_timezone

Description

ISO8601 timezone string, in format:

  • Z | ±hh[mm]

where:

  • hh is "00" - "23" (0-filled to two digits)

  • mm is "00" - "59" (0-filled to two digits)

  • Z is a literal meaning UTC (modern replacement for GMT), i.e. timezone +0000

Inherit

Iso8601_type

Functions

Signature

Meaning

1..1

hour (): Integer

Hour part of timezone - in the range 00 - 13.

1..1

minute (): Integer

Minute part of timezone. Generally 00 or 30.

1..1

sign (): Integer

Direction of timezone expresssed as +1 or -1.

1..1

minute_unknown (): Boolean

Indicates whether minute part known.

1..1
(effected)

is_partial (): Boolean

True if this time zone is partial, i.e. if minutes is missing.

1..1
(effected)

is_extended (): Boolean

True if this time-zone uses ‘:’ separators.

1..1

is_gmt (): Boolean

True if timezone is UTC, i.e. +0000.

1..1

as_string (): String

Return timezone string.

Invariants

Min_hour_valid: sign = -1 implies hour > 0 and hour <= Min_timezone_hour

Max_hour_valid: sign = 1 implies hour > 0 and hour <= Max_timezone_hour

Minute_valid: not minute_unknown implies valid_minute (minute)

Sign_valid: sign = 1 or sign = -1

Iso8601_timezone

ISO8601 timezone string, in format:

  • Z | ±hh[mm]

where:

  • hh is "00" - "23" (0-filled to two digits)

  • mm is "00" - "59" (0-filled to two digits)

  • Z is a literal meaning UTC (modern replacement for GMT), i.e. timezone +0000

Inherits: Any, Ordered, Temporal, Time_Definitions, Iso8601_type

Constants

Seconds_in_minute: Integer = 60 [1..1]

+ Inherited from Time_Definitions

Minutes_in_hour: Integer = 60 [1..1]

+ Inherited from Time_Definitions

Hours_in_day: Integer = 24 [1..1]

+ Inherited from Time_Definitions

Nominal_days_in_month: Real = 30.42 [1..1]

Used for conversions of durations containing months to days and / or seconds.
Inherited from Time_Definitions

Max_days_in_month: Integer = 31 [1..1]

+ Inherited from Time_Definitions

Days_in_year: Integer = 365 [1..1]

+ Inherited from Time_Definitions

Days_in_leap_year: Integer = 366 [1..1]

+ Inherited from Time_Definitions

Max_days_in_year: Integer = Days_in_leap_year [1..1]

+ Inherited from Time_Definitions

Nominal_days_in_year: Real = 365.24 [1..1]

Used for conversions of durations containing years to days and / or seconds.
Inherited from Time_Definitions

Days_in_week: Integer = 7 [1..1]

+ Inherited from Time_Definitions

Months_in_year: Integer = 12 [1..1]

+ Inherited from Time_Definitions

Min_timezone_hour: Integer = 12 [1..1]

Minimum hour value of a timezone (note that the -ve sign is supplied in the ISO8601_TIMEZONE class).
Inherited from Time_Definitions

Max_timezone_hour: Integer = 13 [1..1]

+ Inherited from Time_Definitions

Attributes

value: String [1..1]

Representation of all descendants is a single String.
Inherited from Iso8601_type

Functions

(abstract) is_equal (
other: Any[1]
): Boolean [1..1]

Value equality.
Inherited from Any

infix = (
other: Any[1]
): Boolean [1..1]

Reference equality.
Inherited from Any

Parameters
other

Reference equality.

instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.
Inherited from Any

type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".
Inherited from Any

(abstract) infix < (
other: Ordered[1]
): Boolean [1..1]

Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability.
Inherited from Ordered

valid_year (
y: Integer[1]
): Boolean

Post: Result = y >= 0 [1..1]

+ Inherited from Time_Definitions

valid_month (
m: Integer[1]
): Boolean

Post: Result = m >= 1 and m <= Months_in_year [1..1]

+ Inherited from Time_Definitions

valid_day (
y: Integer[1],
m: Integer[1],
d: Integer[1]
): Boolean

Post: Result = d >= 1 and d <= days_in_month (m, y) [1..1]

True if d >= 1 and d <= days_in_month (m, y)
Inherited from Time_Definitions

valid_hour (
h: Integer[1],
m: Integer[1],
s: Integer[1]
): Boolean

Post: Result = (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0) [1..1]

True if (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0)
Inherited from Time_Definitions

valid_minute (
m: Integer[1]
): Boolean

Post: Result = m >= 0 and m < Minutes_in_hour [1..1]

True if m >= 0 and m < Minutes_in_hour.
Inherited from Time_Definitions

valid_second (
s: Integer[1]
): Boolean

Post: Result = s >= 0 and s < Seconds_in_minute [1..1]

True if s >= 0 and s < Seconds_in_minute .
Inherited from Time_Definitions

valid_fractional_second (
fs: Double[1]
): Boolean

Post: Result = fs >= 0.0 and fs < 1.0 . [1..1]

True if fs >= 0.0 and fs < 1.0 .
Inherited from Time_Definitions

valid_iso8601_date (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date, i.e. takes the complete form:

  • YYYY-MM-DD (extended, preferred) or one of the partial forms YYYY-MM or YYYY

  • YYYYMMDD (compact) or a partial variant YYYYMM.

Where:

  • YYYY is the string form of any positive number in the range 0000 - 9999 (zero-filled to four digits)

  • MM is 01 - 12 (zero-filled to two digits)

  • DD is 01 - 31 (zero-filled to two digits)

The combinations of YYYY, MM, DD numbers must be correct with respect to the Gregorian calendar.
Inherited from Time_Definitions

valid_iso8601_time (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date, i.e. takes the form:

  • hh:mm:ss[(,|.)s+][Z|±hh[:mm]] (extended)

  • hhmmss[(,|.)s+][Z|±hh[mm]] (compact)

  • or one of the partial forms:

    • hh:mm (extended)

    • hhmm or hh (compact)

with an additional optional timezone indicator of:

  • Z or`±hh[:mm]` (extended) ±hh[mm] (compact)

Where:

  • hh is "00" - "23" (0-filled to two digits)

  • mm is "00" - "59" (0-filled to two digits)

  • ss is "00" - "60" (0-filled to two digits)

  • [(,|.)s+] is an optional string consisting of a comma or decimal point followed by numeric string of 1 or more digits, representing a fractional second

  • Z is a literal meaning UTC (modern replacement for GMT), i.e. timezone +0000
    Inherited from Time_Definitions

valid_iso8601_date_time (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 date-time, i.e. takes the form:

  • YYYY-MM-DDThh:mm:ss[(,|.)s+][Z|±hh[:mm]] (extended)

  • YYYYMMDDThhmmss[(,|.)s+][Z|±hh[mm]] (compact)

  • or one of the partial forms:

    • YYYY-MM-DDThh:mm or YYYY-MM-DDThh (extended)

    • YYYYMMDDThhmm or YYYYMMDDThh (compact)
      Inherited from Time_Definitions

valid_iso8601_duration (
s: String[1]
): Boolean [1..1]

String is a valid ISO 8601 duration, i.e. takes the form:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Where each nn represents a number of years, months, etc. nnW represents a number of 7-day weeks.

Note: allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).
Inherited from Time_Definitions

Parameters
s

String is a valid ISO 8601 duration, i.e. takes the form:

  • P[nnY][nnM][nnW][nnD][T[nnH][nnM][nnS]]

Where each nn represents a number of years, months, etc. nnW represents a number of 7- day weeks.

allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration).

is_partial (): Boolean [1..1]

True if this time zone is partial, i.e. if minutes is missing.

is_extended (): Boolean [1..1]

True if this time-zone uses ‘:’ separators.

hour (): Integer [1..1]

Hour part of timezone - in the range 00 - 13.

minute (): Integer [1..1]

Minute part of timezone. Generally 00 or 30.

sign (): Integer [1..1]

Direction of timezone expresssed as +1 or -1.

minute_unknown (): Boolean [1..1]

Indicates whether minute part known.

is_gmt (): Boolean [1..1]

True if timezone is UTC, i.e. +0000.

as_string (): String [1..1]

Return timezone string.

Invariants

Min_hour_valid: sign = -1 implies hour > 0 and hour <= Min_timezone_hour

Max_hour_valid: sign = 1 implies hour > 0 and hour <= Max_timezone_hour

Minute_valid: not minute_unknown implies valid_minute (minute)

Sign_valid: sign = 1 or sign = -1

{
    "name": "Iso8601_timezone",
    "documentation": "ISO8601 timezone string, in format:\n\n* `Z | ±hh[mm]`\n\nwhere:\n\n* `hh` is \"00\" - \"23\" (0-filled to two digits)\n* `mm` is \"00\" - \"59\" (0-filled to two digits)\n* `Z` is a literal meaning UTC (modern replacement for GMT), i.e. timezone `+0000`\n",
    "ancestors": [
        "Iso8601_type"
    ],
    "functions": {
        "hour": {
            "name": "hour",
            "documentation": "Hour part of timezone - in the range 00 - 13.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "minute": {
            "name": "minute",
            "documentation": "Minute part of timezone. Generally 00 or 30.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "sign": {
            "name": "sign",
            "documentation": "Direction of timezone expresssed as +1 or -1.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Integer"
            }
        },
        "minute_unknown": {
            "name": "minute_unknown",
            "documentation": "Indicates whether minute part known.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_partial": {
            "name": "is_partial",
            "documentation": "True if this time zone is partial, i.e. if minutes is missing.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_extended": {
            "name": "is_extended",
            "documentation": "True if this time-zone uses ‘:’ separators.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_gmt": {
            "name": "is_gmt",
            "documentation": "True if timezone is UTC, i.e. +0000.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "as_string": {
            "name": "as_string",
            "documentation": "Return timezone string.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "String"
            }
        }
    },
    "invariants": {
        "Min_hour_valid": "sign = -1 implies hour > 0 and hour <= Min_timezone_hour",
        "Max_hour_valid": "sign = 1 implies hour > 0 and hour <= Max_timezone_hour",
        "Minute_valid": "not minute_unknown implies valid_minute (minute)",
        "Sign_valid": "sign = 1 or sign = -1"
    }
}
iso8601 timezone