Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Time Types: UtcTime and GeneralizedTime

UtcTime

ASN.1 tag 0x17. Represents a time in the range 1950–2049.

Constructor

UtcTime(year: int, month: int, day: int, hour: int, minute: int, second: int)

Year must be in the range 1950–2049. Raises ValueError on invalid input.

Properties

Properties: year, month, day, hour, minute, second (all int). __str__ returns the canonical YYMMDDHHMMSSZ form.

Full class stub

class UtcTime:
    def __init__(self, year: int, month: int, day: int,
                 hour: int, minute: int, second: int) -> None: ...
    year: int
    month: int
    day: int
    hour: int
    minute: int
    second: int
    def __str__(self) -> str: ...   # e.g. "230101120000Z"

Year must be in the range 1950–2049.


GeneralizedTime

ASN.1 tag 0x18. Represents a time with optional millisecond precision.

Constructor

GeneralizedTime(year: int, month: int, day: int, hour: int, minute: int, second: int,
                milliseconds: int | None = None)

Properties

Properties: year, month, day, hour, minute, second (int), milliseconds (int | None). __str__ returns the canonical YYYYMMDDHHMMSS[.fff]Z form.

Full class stub

class GeneralizedTime:
    def __init__(self, year: int, month: int, day: int,
                 hour: int, minute: int, second: int,
                 milliseconds: int | None = None) -> None: ...
    year: int
    month: int
    day: int
    hour: int
    minute: int
    second: int
    milliseconds: int | None
    def __str__(self) -> str: ...   # e.g. "20230101120000Z"