locale
The locale to use when parsing date strings with the specified format. Use system locale if unspecified.
- iOS
- 15.0+
- macOS
- 12.0+
- tvOS
- 15.0+
- watchOS
- 8.0+
var locale: Locale?
The locale to use when parsing date strings with the specified format. Use system locale if unspecified.
var locale: Locale?
s20FoundationEssentials4DateV0A20InternationalizationE13ParseStrategyV6localeAA6LocaleVSgvp
What are these?8AL9M
import FoundationEssentials
import FoundationInternationalization
struct ParseStrategy
Options for parsing string representations of dates to create a Date
instance.
struct Date
Date
represents a single point in time.
struct Locale
Locale
encapsulates information about linguistic, cultural, and technological conventions and standards. Examples of information encapsulated by a locale include the symbol used for the decimal separator in numbers and the way dates are formatted.
init(format: Date.FormatString, locale: Locale? = nil, timeZone: TimeZone, calendar: Calendar = Calendar(identifier: .gregorian), isLenient: Bool = true, twoDigitStartDate: Date = Date(timeIntervalSince1970: 0))
Creates a new ParseStrategy
with the given configurations.
init(from decoder: any Decoder) throws
var calendar: Calendar
The calendar to use when parsing date strings and creating the date.
var format: String { get }
The string representation of the fixed format conforming to Unicode Technical Standard #35.
var isLenient: Bool
Indicates whether to use heuristics when parsing the representation.
var timeZone: TimeZone
The time zone to use for creating the date.
var twoDigitStartDate: Date
The earliest date that can be denoted by a two-digit year specifier.
func consuming(_ input: String, startingAt index: String.Index, in bounds: Range<String.Index>) throws -> (upperBound: String.Index, output: Date)?
func parse(_ value: String) throws -> Date
Returns a Date
of a given string interpreted using the current settings.
typealias RegexOutput = Date