<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Date/FormatStyle/Symbol/SecondFraction",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation4DateV11FormatStyleV6SymbolV14SecondFractionV"
  },
  "title" : "Date.FormatStyle.Symbol.SecondFraction"
}
-->

# Date.FormatStyle.Symbol.SecondFraction

A type that specifies the format for the second fraction in a date format style.

```
struct SecondFraction
```

## Overview

The type [`Date.FormatStyle.Symbol.SecondFraction`](/documentation/Foundation/Date/FormatStyle/Symbol/SecondFraction) includes static factory methods that create custom [`Date.FormatStyle.Symbol.SecondFraction`](/documentation/Foundation/Date/FormatStyle/Symbol/SecondFraction) objects:

|Factory variable                                                                                               |Description                                                                                             |
|---------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
|``doc://com.apple.foundation/documentation/Foundation/Date/FormatStyle/Symbol/SecondFraction/fractional(_:)``  |Returns the numerical representation of the fractional component of the second. For example, `8`, `827`.|
|``doc://com.apple.foundation/documentation/Foundation/Date/FormatStyle/Symbol/SecondFraction/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 [`secondFraction(_:)`](/documentation/Foundation/Date/FormatStyle/secondFraction(_:)). The following example shows a variety of [`Date.FormatStyle.Symbol.SecondFraction`](/documentation/Foundation/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`](/documentation/Foundation/Date/FormatStyle).

## Topics

### Modifying a Second Fraction

[`static func fractional(Int) -> Date.FormatStyle.Symbol.SecondFraction`](/documentation/Foundation/Date/FormatStyle/Symbol/SecondFraction/fractional(_:))

Creates a custom format style representing the fractional seconds component of a date.

[`static func milliseconds(Int) -> Date.FormatStyle.Symbol.SecondFraction`](/documentation/Foundation/Date/FormatStyle/Symbol/SecondFraction/milliseconds(_:))

Creates a custom format style representing the milliseconds elapsed in a day.

### Comparing Second Fractions

[`static func == (Date, Date) -> Bool`](/documentation/Foundation/Date/==(_:_:))

Returns true if the two `Date` values represent the same point in time.

### Type Properties

[`static let omitted: Date.FormatStyle.Symbol.SecondFraction`](/documentation/Foundation/Date/FormatStyle/Symbol/SecondFraction/omitted)

The option for not including the symbol in the formatted output.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`Hashable`](/documentation/Swift/Hashable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Equatable`](/documentation/Swift/Equatable)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)