Skip to main content

Module dates

Module dates 

Source
Expand description

Apple date conversion utilities.

The iMessage database (chat.db) stores dates as Apple timestamps:

  • Epoch: January 1, 2001 00:00:00 UTC
  • Unit: nanoseconds (on High Sierra+, multiplier = 10^9) stored as i64
  • MULTIPLIER = 10^6 is used for the conversion, treating the raw value as microseconds.

The formula: unix_ms = APPLE_EPOCH_MS + (raw_value / MULTIPLIER)

Where: APPLE_EPOCH_MS = 978307200000 (Jan 1, 2001 in Unix ms) MULTIPLIER = 1_000_000

Constants§

APPLE_EPOCH_MS
Unix timestamp (ms) of January 1, 2001 00:00:00 UTC.
MULTIPLIER
The multiplier used in the iMessage database (High Sierra+). Raw DB value / MULTIPLIER = milliseconds offset from Apple epoch.

Functions§

apple_to_unix_ms
Convert a raw Apple timestamp from chat.db to Unix epoch milliseconds.
unix_ms_to_apple
Convert Unix epoch milliseconds to a raw Apple timestamp for chat.db queries.