utctime.UtcTime
- class utctime.UtcTime(year: int, month: int = 1, day: int = 1, hour: int = 0, minute: int = 0, second: int = 0, microsecond: int = 0)
Wrapper class for
datetime.datetimethat’s always in UTC.It behaves in a similar manner and with similar conventions.
You can use it as a type, use the constructor, or use one of the static methods to create
utctime.UtcTimeinstances.- __init__(year: int, month: int = 1, day: int = 1, hour: int = 0, minute: int = 0, second: int = 0, microsecond: int = 0)
Construct new
utctime.UtcTimewith a given date/time.All fields but year are optional.
Unlike the
datetime.datetimeconstructor, thedatetime.datetime.tzinfoargument may not be specified.
Methods
__init__(year[, month, day, hour, minute, ...])Construct new
utctime.UtcTimewith a given date/time.copy_from(other)Return a
utctime.UtcTimefrom anotherutctime.UtcTimeor UTCdatetime.datetimeobject.iso()Returns an ISO 8601 formatted date-time string.
now()Current UTC date and time.
parse_iso(iso8601)Parse an ISO 8601 date-time string and returns a
utctime.UtcTimeinstance.replace([year, month, day, hour, minute, ...])Replace any of the date/time fields.
timestamp()Seconds since the epoch (1970) as a float, as per
datetime.datetime.timestamp().todatetime()Converts back to a regular
datetime.datetimewith a UTC timezone.Attributes
day1 - 31 (depending on the month) as per
datetime.datetime.dayhour0 - 23 as per
datetime.datetime.hourmicrosecond0 - 999999 as per
datetime.datetime.microsecondminute0 - 59 as per
datetime.datetime.minutemonth1 - 12 as per
datetime.datetime.monthsecond0 - 59 as per
datetime.datetime.secondyear1 - 9999 as per
datetime.datetime.year