JsonDateTimeNanoConverter

Ecng.Serialization

Provides a JSON converter for converting DateTime values from Unix timestamps in nanoseconds.

Inherits: JsonDateTimeConverter

Constructors

JsonDateTimeNanoConverter
public JsonDateTimeNanoConverter()
jsonDateTimeNanoConverter = JsonDateTimeNanoConverter()

Initializes a new instance of the JsonDateTimeNanoConverter class using nanoseconds.

Methods

Convert
protected override DateTime Convert(double value)
result = jsonDateTimeNanoConverter.Convert(value)

Converts the specified double value to a DateTime using nanosecond precision.

value
The double value representing the Unix timestamp in nanoseconds.

Returns: A DateTime corresponding to the Unix timestamp.

WriteJson
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
jsonDateTimeNanoConverter.WriteJson(writer, value, serializer)

Writes the JSON representation of the object in nanoseconds.