Declaration
public static string ToIsoStringOptimal(
this DateTime datetime,
IsoDateFormat format = IsoDateFormat.HumanReadable,
IsoDatePrecision minPrecision = IsoDatePrecision.Days,
IsoDatePrecision maxPrecision = IsoDatePrecision.Full,
bool includeTimezone = false
)
Summary
Returns a string representation of the date/time in an ISO-8601-like format. The function will
omit higher-precision parts whose values are zeroes, as permitted by the standard.
Parameters
this DateTime | datetime | Date/time to convert. |
IsoDateFormat | format | One of the several pre-defined formats to use. |
IsoDatePrecision | minPrecision | Minimum precision of the resulting string. The actual precision is determined by what's available in the date/time, bounded by this parameter. |
IsoDatePrecision | maxPrecision | Maximum precision of the resulting string. Any higher-precision parts are truncated. |
bool | includeTimezone | Specifies whether a suffix indicating date/time kind (local/utc/unspecified) and, for local times, a UTC offset, is appended. |