public static DateTime FromISO8601String(
string dateTimeText,
bool toLocalTime
)
Public Shared Function FromISO8601String (
dateTimeText As String,
toLocalTime As Boolean
) As DateTime
public:
static DateTime FromISO8601String(
String^ dateTimeText,
bool toLocalTime
)
static member FromISO8601String :
dateTimeText : string *
toLocalTime : bool -> DateTime
The Parse(String) method is capable of parsing a string in a very specific layout of the ISO 8601 format (SortableDateTimePattern). However, if the string deviates even slightly from that pattern, it cannot be parsed. This method takes an ISO 8601 formatted date string in any of various formats and returns the DateTime value that it represents.
This method does not handle all possible forms of the ISO 8601 format, just those related to date and time values (YYYY-MM-DDTHH:MM:SS.MMMM+HH:MM). Date and time separators (except the 'T') are optional as is the time zone specifier. The time indicator ('T') and the time value can be omitted entirely if not needed. A 'Z' (Zulu) can appear in place of the time zone specifier to indicate universal time. Date/times in universal time format or with a time zone offset are converted to local time if the bToLocalTime parameter is set to true. All other values are assumed to be local time already and will be returned unmodified as are date-only values.
ArgumentException | This is thrown if the specified date/time string is not valid |