JsonTimeFormat Enumeration

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: 3.0.0
public enum JsonTimeFormat



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