Skip to content

DateTimeJsonConverter

QuantConnect.Util.DateTimeJsonConverter

DateTimeJsonConverter(format: str)
DateTimeJsonConverter(format: str, format_2: str)
DateTimeJsonConverter(
    format: str, format_2: str, format_3: str
)

Bases: JsonConverter

Provides a json converter that allows defining the date time format used

Initializes a new instance of the DateTimeJsonConverter class

Parameters:

Name Type Description Default
format str

The date time format

required
format_2 Optional[str]

Other format for backwards compatibility

None
format_3 Optional[str]

Other format for backwards compatibility

None

can_read

can_read: bool

True, can read a json into a date time

can_write

can_write: bool

True, can write a datetime to json

can_convert

can_convert(object_type: Type) -> bool

True if can convert the given object type

read_json

read_json(
    reader: Any,
    object_type: Type,
    existing_value: Any,
    serializer: Any,
) -> Object

Converts the given value

write_json

write_json(
    writer: Any, value: Any, serializer: Any
) -> None

Writes the given value to json