Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: string ToIsoStringRoundtrip(this DateTime, IsoDateFormat, IsoDatePrecision)

Declaration

public static string ToIsoStringRoundtrip(
    this DateTime datetime,
    IsoDateFormat format = IsoDateFormat.HumanReadable,
    IsoDatePrecision minPrecision = IsoDatePrecision.Days
)

Summary

Returns a string representation of the date/time in an ISO-8601-like format. Use this if the result must be round-trippable without losing any information. The function will omit higher-precision parts whose values are zeroes, as permitted by the standard.

Parameters

this DateTimedatetimeDate/time to convert.
IsoDateFormatformatOne of the several pre-defined formats to use.
IsoDatePrecisionminPrecisionMinimum precision of the resulting string. The actual precision is determined by what's available in the date/time, bounded by this parameter.