Type Method_StringProcessing
dateTime(date:time:locale:timeZone:calendar:)
Date. The date string is expected to follow the format of what Date.FormatStyle(date:time:locale:calendar:) produces.static func dateTime(date: Date.FormatStyle.DateStyle, time: Date.FormatStyle.TimeStyle, locale: Locale, timeZone: TimeZone, calendar: Calendar? = nil) -> Date.ParseStrategy
Parameters
dateThe style that describes the date part of the string. For example,
.numericmatches “10/21/2015”, and.abbreviatedmatches “Oct 21, 2015” as October 21, 2015 in theen_USlocale.timeThe style that describes the time part of the string.
localeThe locale of the string to be matched.
timeZoneThe time zone to create the matched date with. Ignored if the string contains a time zone and matches the specified style.
calendarThe calendar with which to interpret the date string. If set to nil, the default calendar of the specified
localeis used.
Return Value
A RegexComponent to match a localized date string.
Discussion
Note
If the string contains a time zone and matches the specified style, then the timeZone argument is ignored. For example, “Oct 21, 2015 4:29:24 PM PDT” matches .dateTime(date: .abbreviated, time: .complete, ...) and is captured as October 13, 2022, 20:29:24 PDT regardless of the timeZone value.