Cocoa (Core Data) Timestamp to Unix

Apple counts from 2001-01-01, not 1970 — the reference date NSDate was built on, and the one hiding inside Core Data stores and iOS app databases. Type the number and get Unix seconds, milliseconds and UTC. Negative values are legitimate here, and the widget says why.

[SEC.01 // CONVERT]

Cocoa reference-date time to Unix

S · MS · US · NS

Enter a value to see results below. timeIntervalSinceReferenceDate counts from 2001-01-01 GMT, so dates before the reference date are legitimately negative (1998 is about -94665600 seconds).

Unit on the wire
Unix seconds (s) —
Unix milliseconds (ms) —
ISO 8601 (UTC) —

Modern iOS Messages databases often use nanoseconds from 2001; older versions can use seconds. Core Data dates commonly store seconds from 2001 as a double, but its private schema is not a stable API. Confirm the schema and choose the matching unit. Results round to the nearest millisecond.

[SEC.02 // THE 2001 EPOCH]

Why Apple starts 31 years after Unix

OFFSET 978307200

Cocoa's reference date is 2001-01-01 00:00:00 GMT — a post-Y2K reset chosen when NeXT's Foundation framework became Apple's. NSDate, timeIntervalSinceReferenceDate and every API that says "seconds since the reference date" measure from there. The gap to the Unix epoch is 11,323 days: 31 years containing 8 leap days, which is where the constant comes from.

  • unix_seconds = cocoa_seconds + 978307200 — and the reverse subtracts it. No other trick.
  • Negatives are the point. NSDate stores a double, so a date before 2001 is simply a negative number: 1998-01-01 00:00 UTC is -94694400 in Cocoa seconds. A converter that rejects the minus sign was written against the Unix assumption and will silently drop your historical rows.
  • One epoch, different units. Foundation APIs and typical Core Data SQLite date attributes use floating-point seconds since 2001. Some Messages database versions use integer nanoseconds instead. Confirm the field and version; mixing units can produce an out-of-range or implausible date.
Value at 2026-01-01 00:00 UTCUnitDigits
788918400Cocoa seconds9
788918400000Cocoa milliseconds12
788918400000000Cocoa microseconds15
788918400000000000Cocoa nanoseconds (some Messages schemas)18
1767225600Unix seconds10

Note the collision: an 18-digit Cocoa-nanosecond value looks exactly like the shape of a Windows FILETIME. Contemporary prefixes offer a clue — Cocoa nanoseconds around 2026 start with 78/79, FILETIME with 134 — but the source schema must settle the unit — see the FILETIME page for the Microsoft side of that ambiguity.

[SEC.03 // READING APPLE STORES]

Core Data, Messages and plist values

SQLITE + SWIFT
  • Core Data SQLite store. Date attributes typically use floating-point seconds since 2001. For a confirmed seconds-valued column, the conversion is datetime(value + 978307200, 'unixepoch'). The backing schema is private: table names, column names and custom encodings must be checked for the actual store; a Z prefix alone does not identify a date.
  • Messages databases. Some newer message.date schemas use nanoseconds since 2001: for those, SELECT datetime(date / 1000000000 + 978307200, 'unixepoch') FROM message; prints whole-second UTC text. Older schemas may use seconds. Verify the OS version and each field separately; zero in a read-time field may mean unread rather than the reference date.
  • Swift. Date(timeIntervalSinceReferenceDate: v) decodes, .timeIntervalSinceReferenceDate encodes, and Date(timeIntervalSince1970: u) is the same instant in the Unix frame — the initializer name is the unit declaration, so never mix the two.
  • Property lists. A plist date normally serializes as an ISO 8601 string, but caches, defaults-style preference dumps and some crash logs carry raw Cocoa doubles. The string form tells you its own zone; the number tells you nothing until you know which epoch produced it.

One more Apple calendar worth recognizing: classic Mac OS and HFS+ volumes counted seconds from 1904-01-01, the same start date Excel's 1904 date system uses (see the Excel serial page). Modern macOS with APFS uses plain Unix nanoseconds, which is why a single archive can contain all three epochs.

[DOC.FAQ // INDEX]

ANSWERS

05 ITEMS
01 What is the offset between Cocoa and Unix timestamps?

978,307,200 seconds — 11,323 days from 1970-01-01 to 2001-01-01, i.e. 31 years including 8 leap days. Add it to a Cocoa value to get Unix time; subtract it to go the other way.

02 Why is my Apple timestamp negative?

Because the date is before the 2001 reference date. NSDate is a double counting from 2001-01-01 GMT, so 1990s and 1960s dates are negative by design and are perfectly valid. Only a Unix assumption would call them corrupt.

03 How do I convert chat.db message dates to readable time?

First confirm the database version and field unit. For nanoseconds since 2001, use SELECT datetime(date / 1000000000 + 978307200, 'unixepoch') FROM message;. For seconds-based schemas, omit the division. This returns UTC text at whole-second precision; inspect sentinel values separately.

04 Is a Core Data date column seconds or nanoseconds?

Typical Core Data SQLite date attributes are floating-point seconds since 2001, like NSDate reference-date intervals. Nanoseconds in some Messages databases are a separate schema convention, not a general Core Data rule. Verify private backing-store fields before applying any formula.

05 What is 2026-01-01 in Cocoa seconds?

788918400 — Unix 1767225600 minus 978307200. Type it into the widget with the unit on "seconds" and the ISO row should read 2026-01-01T00:00:00.000Z.

[SEC.MATRIX // RELATED]

Related tools

3 PAGES

Sources and specifications