KGy SOFT

JsonTimeFormat Enumeration

KGy SOFT JSON Libraries Help
Specifies how TimeSpan and TimeOnly instances are formatted and parsed by the JsonValueExtensions methods.

Namespace:  KGySoft.Json
Assembly:  KGySoft.Json (in KGySoft.Json.dll) Version: 2.0.0
Syntax

public enum JsonTimeFormat
Members

  Member nameValueDescription
Auto0

When converting to JSON, it is equivalent to the Text format if the target Type is String, or the Milliseconds format if the target Type is Number.

When parsing a JsonValue, it represents any defined JsonTimeFormat format.

Note: Parsing TimeSpan/TimeOnly values with the Auto option formatted as numeric values (Milliseconds and Ticks) can be ambiguous. Though a "sanity check" is applied for parsing such values use a specific option whenever possible.

Milliseconds1 Represents a time in milliseconds. This is conform with the difference of two Date instances in JavaScript.
Ticks2 Represents a time in 100 nanoseconds. This is conform with the constructor of the .NET TimeSpan/TimeOnly types and their Ticks property.
Text3 Represents a time as a textual value. This is conform with the regular string representation of the TimeSpan/TimeOnly types.
See Also

Reference