This module offers general convenience and utility functions for dealing with datetimes.
New in version 2.7.0.
||Sets the the
||Useful for comparing two datetimes that may a negilible difference|
datetimerepresenting the current day at midnight
Parameters: tzinfo – The time zone to attach (also used to determine the current day). Returns: A
datetime.datetimeobject representing the current day at midnight.
Sets the the
tzinfoparameter on naive datetimes only
This is useful for example when you are provided a datetime that may have either an implicit or explicit time zone, such as when parsing a time zone string.
- dt – The datetime on which to replace the time zone
- tzinfo – The
datetime.tzinfosubclass instance to assign to
dtif (and only if) it is naive.
Returns an aware
within_delta(dt1, dt2, delta)¶
Useful for comparing two datetimes that may a negilible difference to be considered equal.