Real Epoch Converter logo realepochconverter
cocoa / core data converter

Cocoa Core Data Timestamp Converter. Seconds Since 2001

Apple's Foundation framework counts time in seconds since 2001-01-01 00:00:00 UTC, the Cocoa epoch. Any NSDate you export, and any Core Data store you inspect, is full of these values.

converter

Cocoa Core Data time → dates.

Core Data's Date stores seconds since 2001 (an epoch that shows up in iCloud records, SQLite stores, and synced plists.

The 2001 epoch, and why it exists

NeXTSTEP's engineers picked 2001 as the reference date for the NSDate type. A round "start of the millennium" that kept epoch values small and readable in the platform's early years. Today a Core Data Date attribute is stored as seconds since that instant, so 807753600 is 2026, not 1995. Converting is simple: Unix time = cocoa seconds + 978,307,200 (the 1970→2001 gap).

Where you meet Cocoa time

  • Core Data SQLite stores, the Z… date columns hold Cocoa seconds; a value like 8.069724e8 is a float in the raw DB.
  • iCloud and CloudKit records. Exported NSDate values and sync payloads use the same epoch.
  • Plist exports, macOS tools that dump .plist files often show these seconds before any app-layer formatting.
  • Swift code. Date().timeIntervalSince1970 returns Unix seconds, but timeIntervalSinceReferenceDate returns Cocoa seconds; mixing them is a classic off-by-31-years bug.

Core Data values, decoded

  • 807753600 → Aug 7, 2026 00:00:00 UTC. Check: 807,753,600 + 978,307,200 = 1,786,060,800 seconds = Aug 7, 2026 00:00:00 UTC. (Watch out: 806972400 is a value often quoted for this example, but it decodesto Jul 28, 2026 23:00 UTC, and read as plain Unix time it is Jul 28, 1995 23:00 — mixing the two clocks is exactly the classic Cocoa bug.)
  • 0 → Jan 1, 2001 00:00:00 UTC, the epoch itself.
  • 807753600.5 → Aug 7, 2026 00:00:00.5 UTC. The tool accepts fractional seconds, exactly as Core Data stores them — but note display precision is whole seconds, so the half second is preserved in the Unix-seconds row, not the clock digits.

NSDate and Cocoa seconds in your own code

  • Swift: Date(timeIntervalSinceReferenceDate: cocoaSeconds) to decode; date.timeIntervalSinceReferenceDate to encode.
  • Python: datetime.fromtimestamp(cocoa + 978307200, tz=timezone.utc).
  • SQL: datetime(cocoa + 978307200, 'unixepoch') in SQLite.

Gotchas: the 31-year shift, fractions, and negative values

  • Reference vs Unix, never feed Cocoa seconds into a Unix formatter; the ~31-year offset puts every date in the wrong decade.
  • Fractions. Core Data stores sub-second precision as a decimal part. The converter accepts and returns fractional seconds.
  • Negative values, anything before 2001 is a negative number. The converter handles them, back to the earliest representable dates.

First published · Last reviewed · Maintained and developed by the Real Epoch Converter team · Email · Contact · Methodology

Copied