whylogs.util.time

Functions for interacting with timestamps and datetime objects

Module Contents

Functions

to_utc_ms(dt: datetime.datetime) → Optional[int]

Convert a datetime object to UTC epoch milliseconds

from_utc_ms(utc: Optional[int]) → Optional[datetime.datetime]

Convert a UTC epoch milliseconds timestamp to a datetime object

whylogs.util.time.to_utc_ms(dt: datetime.datetime) Optional[int]

Convert a datetime object to UTC epoch milliseconds

Returns

timstamp_ms – Timestamp

Return type

int

whylogs.util.time.from_utc_ms(utc: Optional[int]) Optional[datetime.datetime]

Convert a UTC epoch milliseconds timestamp to a datetime object

Parameters

utc (int) – Timestamp

Returns

dt – Datetime object

Return type

datetime.datetime