Cocoa / Apple Timestamp Converter
Paste an NSTimeInterval or CFAbsoluteTime value (seconds since January 1, 2001) and instantly see the UTC date, ISO 8601 string, and Unix timestamp.
Apple's reference date
Apple platforms (iOS, macOS, watchOS, tvOS) use January 1, 2001 as their reference point when representing absolute time. This value is called CFAbsoluteTime in Core Foundation and NSTimeInterval in Foundation when used with Date.timeIntervalSinceReferenceDate.
The offset from Unix time is 978,307,200 seconds (31 years). You will encounter these values when inspecting a Core Data SQLite database directly, reading diagnostic logs, or debugging with LLDB on an iOS or macOS device.
Converting timestamps in Swift and Objective-C
Frequently asked questions
What is NSTimeInterval?
NSTimeInterval is the Swift and Objective-C type alias for Double, used to represent a duration or timestamp in seconds. When used as an absolute timestamp (via CFAbsoluteTime or Date.timeIntervalSinceReferenceDate), it counts seconds since January 1, 2001 at 00:00:00 UTC — Apple's reference date.
Why does Apple use January 1, 2001 as the epoch?
Apple chose January 1, 2001 as the reference date when macOS X was being designed, marking the start of Apple's new platform era. This is purely a convention; the actual hardware clocks still track real UTC time. The offset from Unix time (1970) is exactly 978,307,200 seconds.
How do I get the current Cocoa timestamp in Swift?
Use Date().timeIntervalSinceReferenceDate for the CFAbsoluteTime value, or Date().timeIntervalSince1970 for Unix time. To convert between them: let unixTime = cocoaTime + 978307200.
Where do I see these timestamps?
Core Data stores Date attributes as NSTimeInterval relative to 2001-01-01. SQLite databases backing Core Data contain these raw float values. Debugging with LLDB or inspecting a Core Data SQLite file directly will expose these numbers. Some iOS diagnostic logs and crash reports also use CFAbsoluteTime.
What is the difference between NSTimeInterval and Unix time?
Both measure seconds, but from different starting points. Unix time counts from January 1, 1970; NSTimeInterval (as CFAbsoluteTime) counts from January 1, 2001. The difference is 978,307,200 seconds. To go from Cocoa to Unix: add 978307200. To go from Unix to Cocoa: subtract 978307200.
Can the value be negative?
Yes. A negative NSTimeInterval represents a date before January 1, 2001. For example, -31536000 is approximately January 1, 2000. This converter handles negative values correctly.