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.