<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "os",
  "identifier" : "/documentation/os/OSLogInt32ExtendedFormat/secondsSince1970",
  "metadataVersion" : "0.1.0",
  "role" : "Case",
  "symbol" : {
    "kind" : "Case",
    "modules" : [
      "os"
    ],
    "preciseIdentifier" : "s:2os24OSLogInt32ExtendedFormatO16secondsSince1970yA2CmF"
  },
  "title" : "OSLogInt32ExtendedFormat.secondsSince1970"
}
-->

# OSLogInt32ExtendedFormat.secondsSince1970

A format that displays a 32-bit integer as a date.

```
case secondsSince1970
```

## Discussion

Use this option to format the interpolated value as a date and time, such as `2007-01-09 09:41:00`. The formatter considers the value you provide as a duration, in seconds, and adds it to the UNIX epoch to calculate the date it displays. The UNIX epoch is a method of describing a specific point in time using the elapsed number of seconds since 00:00:00 UTC January 1, 1970.

The following example applies the `secondsSince1970` formatter to the 32-bit integer value `604_800`, which is the exact number of seconds in one week:

```swift
// Create a logger with the specified subsystem and category.
let logger = Logger(subsystem: "com.example.OSLogValueFormatting",
                    category: "Formatter Output")
                
// Assign the value to interpolate. In this case, the number of
// seconds in an entire week.
let value: Int32 = 604_800
                
// Write the value to the log using the specified format.
logger.info(".secondsSince1970 output is \(value, format: .secondsSince1970)")
```

And the system writes the following message to the log:

```
[Formatter Output] .secondsSince1970 output is 1970-01-08 00:00:00
```

---

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)