Initializer
init(date:time:locale:calendar:timeZone:capitalizationContext:)
iOS 15.0+
iPadOS 15.0+
Mac Catalyst 15.0+
macOS 12.0+
tvOS 15.0+
watchOS 8.0+
Creates a new
FormatStyle with the given configurations.init(date: Date.FormatStyle.DateStyle? = nil, time: Date.FormatStyle.TimeStyle? = nil, locale: Locale = .autoupdatingCurrent, calendar: Calendar = .autoupdatingCurrent, timeZone: TimeZone = .autoupdatingCurrent, capitalizationContext: FormatStyleCapitalizationContext = .unknown)
Parameters
dateThe date style for formatting the date.
timeThe time style for formatting the date.
localeThe locale to use when formatting date and time values.
calendarThe calendar to use for date values.
timeZoneThe time zone with which to specify date and time values.
capitalizationContextThe capitalization formatting context used when formatting date and time values.
Discussion
Note
Always specify the date style, time style, or the date components to be included in the formatted string with the symbol modifiers. Otherwise, an empty string will be returned when you use the instance to format a Date.