<!--
{
  "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/Second",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation4DateV11FormatStyleV6SymbolV6SecondV"
  },
  "title" : "Date.FormatStyle.Symbol.Second"
}
-->

# Date.FormatStyle.Symbol.Second

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

```
struct Second
```

## Overview

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

|Factory variable                                                                                    |Description                                                                             |
|----------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|
|``doc://com.apple.foundation/documentation/Foundation/Date/FormatStyle/Symbol/Second/defaultDigits``|The minimum number of digits that represents the numeric second. For example, `1`, `18`.|
|``doc://com.apple.foundation/documentation/Foundation/Date/FormatStyle/Symbol/Second/twoDigits``    |Two-digit numeric second, zero-padded if necessary. For example, `01`, `18`.            |

To customize the second format in a string representation of a `Date`, use [`second(_:)`](/documentation/Foundation/Date/FormatStyle/second(_:)). The following example shows a variety of [`Date.FormatStyle.Symbol.Second`](/documentation/Foundation/Date/FormatStyle/Symbol/Second) format styles applied to a date.

```swift
let meetingDate = Date() // Feb 9, 2021 at 3:05 PM
meetingDate.formatted(Date.FormatStyle().second(.defaultDigits)) // 5
meetingDate.formatted(Date.FormatStyle().second(.twoDigits)) // 05
meetingDate.formatted(Date.FormatStyle().second()) // 5
```

If no format is specified as a parameter, the [`defaultDigits`](/documentation/Foundation/Date/FormatStyle/Symbol/Second/defaultDigits) static variable is the default format.

For more information about formatting dates, see the [`Date.FormatStyle`](/documentation/Foundation/Date/FormatStyle).

## Topics

### Modifying a Second

[`static var defaultDigits: Date.FormatStyle.Symbol.Second`](/documentation/Foundation/Date/FormatStyle/Symbol/Second/defaultDigits)

The custom format style that conveys the minimum number of digits that represents the numeric second.

[`static var twoDigits: Date.FormatStyle.Symbol.Second`](/documentation/Foundation/Date/FormatStyle/Symbol/Second/twoDigits)

The custom format style that conveys a two-digit numeric second, zero-padded if necessary.

### Comparing Seconds

[`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.Second`](/documentation/Foundation/Date/FormatStyle/Symbol/Second/omitted)

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

## Relationships

### Conforms To

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

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

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

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

---

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)