CURRENT EPOCH · EPOCHTIME.TOOLS · A PRECISION INSTRUMENT FOR TIME
Converter Batch Difference Blog
Languages
JavaScript Python TypeScript Go Rust Java PHP SQL Bash
Specialty
LDAP Timestamp .NET Ticks Chrome/WebKit Cocoa / Core Data Discord Timestamp Excel OADate Unix Hex
Standards
ISO 8601 Guide Year 2038 NTP Timestamp GPS Time Julian Day
01 Input
Paste a Cocoa timestamp (seconds since 2001) or a date
Cocoa epoch is 2001-01-01 UTC. Offset from Unix epoch: 978307200 seconds.
02 Output
Cocoa timestamp
Unix seconds
Unix milliseconds
ISO 8601 (UTC)
Human-readable

What is a Cocoa timestamp?

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:

Why 2001?

Apple 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.

Where you'll see it in practice

Core Data SQLite

-- 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;

Binary plist

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.

Conversion formulas

Cocoa → Unix seconds

unix_seconds = cocoa_seconds + 978307200

Unix seconds → Cocoa

cocoa_seconds = unix_seconds - 978307200

The constant 978307200 is the number of seconds from 1970-01-01 to 2001-01-01 UTC.

Code examples

Swift

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

Python

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

JavaScript

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;
}

Tip: Inspecting Core Data files

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.