Apple's Cocoa framework (used in macOS and iOS) represents dates as NSTimeInterval values — seconds since January 1, 2001 UTC. This format appears in Core Data stores, plist files, and iOS app data. This converter handles both directions.
Apple's Cocoa framework (used in macOS and iOS development) uses NSDate to represent points in time. Internally, NSDate stores a 64-bit floating-point number called NSTimeInterval — the number of seconds (with fractional precision) since January 1, 2001, 00:00:00 UTC.
You'll encounter Cocoa timestamps when:
Z-prefixed timestamp columns).plist) filesApple chose 2001-01-01 as the reference epoch when designing Cocoa for Mac OS X in the late 1990s. The intent was forward-looking — at the time, choosing a "future" epoch was meant to maximize the useful range of 32-bit floating-point representation. Modern Cocoa uses 64-bit doubles, so the choice is now mostly historical.
-- Core Data stores timestamps in columns named ZDATE, ZCREATEDAT, ZTIMESTAMP, etc.
-- The values are Cocoa timestamps (REAL type in SQLite).
SELECT
Z_PK,
ZCREATEDAT,
datetime(ZCREATEDAT + 978307200, 'unixepoch') AS readable
FROM ZNOTE;
When NSDate is serialized in a binary plist, the timestamp is stored as an 8-byte floating-point value preceded by the 0x33 type marker.
unix_seconds = cocoa_seconds + 978307200
cocoa_seconds = unix_seconds - 978307200
The constant 978307200 is the number of seconds from 1970-01-01 to 2001-01-01 UTC.
import Foundation
// Cocoa timestamp to Date
let cocoa: TimeInterval = 757382400
let date = Date(timeIntervalSinceReferenceDate: cocoa)
print(date) // 2025-01-01 00:00:00 +0000
// Date to Cocoa timestamp
let now = Date()
let cocoaTimestamp = now.timeIntervalSinceReferenceDate
// Cocoa to Unix
let unixTimestamp = date.timeIntervalSince1970
from datetime import datetime, timezone
COCOA_OFFSET = 978307200
def cocoa_to_datetime(cocoa_sec: float) -> datetime:
return datetime.fromtimestamp(cocoa_sec + COCOA_OFFSET, tz=timezone.utc)
def datetime_to_cocoa(dt: datetime) -> float:
return dt.timestamp() - COCOA_OFFSET
const COCOA_OFFSET = 978307200;
function cocoaToDate(cocoaSec) {
return new Date((cocoaSec + COCOA_OFFSET) * 1000);
}
function dateToCocoa(date) {
return Math.floor(date.getTime() / 1000) - COCOA_OFFSET;
}
Core Data stores its data in SQLite files inside the app's Application Support directory. On macOS:
~/Library/Containers/<bundle-id>/Data/Library/Application Support/<app>/
Open the .sqlite file with any SQLite client. Timestamp columns will be readable as REAL values; convert them with the formula above to get human-readable dates.