Type Method_StringProcessing
date(format:locale:timeZone:calendar:twoDigitStartDate:)
iOS 16.0+
iPadOS 16.0+
Mac Catalyst 16.0+
macOS 13.0+
tvOS 16.0+
watchOS 9.0+
Creates a regex component to match a localized date string following the specified format and capture the string as a
Date.static func date(format: Date.FormatString, locale: Locale, timeZone: TimeZone, calendar: Calendar? = nil, twoDigitStartDate: Date = Date(timeIntervalSince1970: 0)) -> Self
Parameters
formatThe date format that describes the localized date string. For example,
"\(month: .twoDigits)_\(day: .twoDigits)_\(year: .twoDigits)"matches “05_04_22” as May 4th, 2022 in the Gregorian calendar.localeThe locale of the date string to be matched.
timeZoneThe time zone to create the matched date with.
calendarThe calendar with which to interpret the date string. If nil, the default calendar of the specified
localeis used.
Return Value
A RegexComponent to match a localized date string.