Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: string ToIsoStringCustom(this DateTime, IsoDatePrecision, char?, char?, char?, bool)

Declaration

public static string ToIsoStringCustom(
    this DateTime datetime,
    IsoDatePrecision precision = IsoDatePrecision.Full,
    char? charInDate = -,
    char? charInTime = :,
    char? charBetween =  ,
    bool includeTimezone = false
)

Summary

Returns a string representation of the date/time in an ISO-8601-like format. The date/time components are always ordered from largest (year) to smallest (nanoseconds), and they are always specified as a fixed-width numeric value. The separators between the parts can be customized.

Parameters

this DateTimedatetimeDate/time to convert.
IsoDatePrecisionprecisionWhich date/time components are to be included. The values are truncated, not rounded.
char?charInDateThe character to insert between years, months and days, or null for none.
char?charInTimeThe character to insert between hours, minutes and seconds (including timezone offset), or null for none.
char?charBetweenThe character to insert between the date and the time part, or null for none (which is never valid in ISO-8601).
boolincludeTimezoneSpecifies whether a suffix indicating date/time kind (local/utc/unspecified) and, for local times, a UTC offset, is appended.