Skip to main content

utcoffset

Return the current offset to UTC in hours.

def utcoffset(
time: ModuleType = _time,
localtime: Callable[..., _time.struct_time] = _time.localtime
) - > float

Return the current offset to UTC in hours.

Parameters

NameTypeDescription
timeModuleType = _timeThe time module used to access timezone and altzone constants.
localtimeCallable[..., _time.struct_time] = _time.localtimeA function that returns a struct_time object used to determine if daylight saving time is currently active.

Returns

TypeDescription
floatThe number of hours offset from UTC, adjusted for daylight saving time if applicable.