<!--
{
  "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/secondFraction(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation4DateV11FormatStyleV14secondFractionyA2E6SymbolV06SecondF0VF"
  },
  "title" : "secondFraction(_:)"
}
-->

# secondFraction(_:)

Modifies the date format style to use the specified second fraction format style.

```
func secondFraction(_ format: Date.FormatStyle.Symbol.SecondFraction) -> Date.FormatStyle
```

## Parameters

`format`

The second fraction format style applied to the date format style.

## Return Value

A date format style modified to include the specified second fraction style.

## Discussion

Static methods that return [`Date.FormatStyle.Symbol.SecondFraction`](/documentation/Foundation/Date/FormatStyle/Symbol/SecondFraction) objects include [`fractional(_:)`](/documentation/Foundation/Date/FormatStyle/Symbol/SecondFraction/fractional(_:)) and [`milliseconds(_:)`](/documentation/Foundation/Date/FormatStyle/Symbol/SecondFraction/milliseconds(_:)).

This 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.827 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 [`Date.FormatStyle`](/documentation/Foundation/Date/FormatStyle).

---

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)