utilities.datetimeutils package

Submodules

utilities.datetimeutils.jsondatetimeencoder module

class utilities.datetimeutils.jsondatetimeencoder.JsonDatetimeEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)

Bases: json.encoder.JSONEncoder

Class extending json.JSONEncoder to handle datetime objects.

Code taken directly from stackoverflow

default(obj)

If a datetime.date, datetime.time, or datetime.datetime object is passed in obj, the object’s isoformat string will be returned. If the object is not one of these types, the base implementation is called (to raise a TypeError).

Parameters

obj (datetime.date, datetime.time or datetime.datetime) – a datetime object

Returns

a string containing the isoformat (ISO 8601) string of the input

Return type

str

Module contents