klyn.time.DateTime.DateTime
constructor

    public DateTime(text as String, timeZone as TimeZone = TimeZone.local):

Description

Constructs a DateTime by parsing an ISO 8601 date-time string.

Parameters

Parameter | Description
--- | ---
`text` | The ISO 8601 formatted string.
`timeZone` | The time zone used when the text has no explicit offset.

Throws

- ValueException if the text or one of its date/time components is invalid.

Example

    import klyn.time
    dt = DateTime("2025-04-18T14:30:00+02:00")
    print(dt.year, dt.month, dt.day)