Structure
Date.FormatStyle.Symbol.Minute
iOS 15.0+
iPadOS 15.0+
Mac Catalyst 15.0+
macOS 12.0+
tvOS 15.0+
watchOS 8.0+
A type that specifies the format for the minutes in a date format style.
struct Minute
Overview
The type Date.FormatStyle.Symbol.Minute includes static factory variables that create custom Date.FormatStyle.Symbol.Minute objects:
Factory variable |
Description |
|---|---|
The minimum number of digits that represents the numeric minute. For example, |
|
Two-digit numeric minute, zero-padded if necessary. For example, |
To customize the minute format in a string representation of a Date, use minute(_:). The following example shows a variety of Date.FormatStyle.Symbol.Minute format styles applied to a date.
let meetingDate = Date() // Feb 9, 2021 at 3:05 PM
meetingDate.formatted(Date.FormatStyle().minute(.defaultDigits)) // 5
meetingDate.formatted(Date.FormatStyle().minute(.twoDigits)) // 05
meetingDate.formatted(Date.FormatStyle().minute()) // 5
If no format is specified as a parameter, the defaultDigits static variable is the default format.
For more information about formatting dates, see the Date.FormatStyle.
Topics
Type Properties
static var defaultDigits: Date.FormatStyle.Symbol.MinuteMinimum digits to show the numeric minute. Truncated, not rounded. For example,8,59.static let omitted: Date.FormatStyle.Symbol.MinuteThe option for not including the symbol in the formatted output.static var twoDigits: Date.FormatStyle.Symbol.MinuteTwo-digit numeric, zero padded if needed. For example,08,59.
Relationships
Conforms To
Swift.EquatableSwift.HashableSwift.SendableSwift.SendableMetatype