PyXWF.TimeUtils – Utility functions for date/time related things

Some helper functions for dealing with time issues (especially converting from/to local timezone to/from utc).

PyXWF.TimeUtils.from_timestamp(timestamp)

Convert a timestamp like returned by to_timestamp() to a utc datetime object.

PyXWF.TimeUtils.next_month(dt)[source]

Get the datetime representing the first day of the month after the month set in dt.

PyXWF.TimeUtils.normalize_date(date_time)[source]

Returns a plain date (with time information reset to midnight) from the given date_time object.

PyXWF.TimeUtils.now()[source]

The current time in UTC as unix timestamp.

PyXWF.TimeUtils.now_date()[source]

The current time in UTC as datetime object.

PyXWF.TimeUtils.strip_microseconds(date_time)[source]

Remove microseconds from the given date_time object.

PyXWF.TimeUtils.to_datetime(timestamp)[source]

Convert a timestamp like returned by to_timestamp() to a utc datetime object.

PyXWF.TimeUtils.to_timestamp(datetime)[source]

Convert datetime to a UTC unix timestamp.

Previous topic

PyXWF.HTTPUtils – Utility functions for HTTP

Next topic

PyXWF.AcceptHeaders – Dealing with HTTP Accept headers

This Page