Contents

init(date:time:locale:calendar:timeZone:capitalizationContext:)

Creates an instance using the provided date, time, locale, calendar, time zone, and capitalization context.

Declaration

init(date: Date.FormatStyle.DateStyle? = nil, time: Date.FormatStyle.TimeStyle? = nil, locale: Locale = .autoupdatingCurrent, calendar: Calendar = .autoupdatingCurrent, timeZone: TimeZone = .autoupdatingCurrent, capitalizationContext: FormatStyleCapitalizationContext = .unknown)

Parameters

  • date:

    The Datestyle used to create the string representation of the date.

  • time:

    The Timestyle used to create the string representation of the date.

  • locale:

    The Locale used to create the string representation of the date.

  • calendar:

    The Calendar used to create the string representation of the date.

  • timeZone:

    The Timezone used to create the string representation of the date.

  • capitalizationContext:

    The Formatstylecapitalizationcontext used to create the string representation of the date.

Discussion

Customize the date string by providing a date style, time style, locale, calendar, time zone, and capitalization scheme.

Date style values are complete, long, abbreviated, numeric, omitted, or none. Time style values are complete, standard, shortened, omitted, or none.