A type that specifies the format for the second fraction in a date format style.
The type ``Date/FormatStyle/Symbol/SecondFraction`` includes static factory methods that create custom ``Date/FormatStyle/Symbol/SecondFraction`` objects:
|Factory variable|Description|
|---|---|
| ``fractional(_:)`` | Returns the numerical representation of the fractional component of the second. For example, `8`, `827`. |
| ``milliseconds(_:)`` | Returns the number of milliseconds elapsed in the day. For example, `11122827`. |
To customize the second format in a string representation of a `Date`, use ``Date/FormatStyle/secondFraction(_:)``. The following example shows a variety of ``Date/FormatStyle/Symbol/SecondFraction`` format styles applied to a date.
```swift
let meetingDate = Date() // Feb 9, 2021 at 3:05:41 PM
meetingDate.formatted(Date.FormatStyle().secondFraction(.fractional(3))) // 827
meetingDate.formatted(Date.FormatStyle().secondFraction(.fractional(1))) // 8
meetingDate.formatted(Date.FormatStyle().secondFraction(.milliseconds(4))) // 11122827
```
For more information about formatting dates, see the ``Date/FormatStyle``.
Fractional second (numeric).
Truncates, like other numeric time fields, but in this case to the number of digits specified by the associated `Int`.
For example, specifying `4` for seconds value `12.34567` yields `12.3456`.
Milliseconds in day (numeric).
The associated `Int` specifies the minimum number of digits, with zero-padding as necessary. The maximum number of digits is 9.
This field behaves exactly like a composite of all time-related fields, not including the zone fields. As such, it also reflects discontinuities of those fields on DST transition days. On a day of DST onset, it will jump forward. On a day of DST cessation, it will jump backward. This reflects the fact that is must be combined with the offset field to obtain a unique local time value.
get · iOS 18.0+
omitted
TypeScript
static get omitted(): Date_FormatStyle_Symbol_SecondFraction
Swift declaration
static let omitted: Date.FormatStyle.Symbol.SecondFraction
The option for not including the symbol in the formatted output.