From e8379ade979c7a83c5217fd81c6221d8a05fef2e Mon Sep 17 00:00:00 2001 From: Neil Pankey Date: Thu, 2 Jul 2020 11:39:03 -0700 Subject: [PATCH] Add note about "parsing" NSDate's from SQL --- Understanding-the-Photos-database.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Understanding-the-Photos-database.md b/Understanding-the-Photos-database.md index 1a0715e..512560e 100644 --- a/Understanding-the-Photos-database.md +++ b/Understanding-the-Photos-database.md @@ -40,6 +40,14 @@ Dates & times in the database are stored as a MacOS time value which is the numb td = (datetime(2001, 1, 1, 0, 0) - datetime(1970, 1, 1, 0, 0)).total_seconds() ``` +The `NSDate` values can also be "parsed" directly with [sqlite's `datetime` function](https://sqlite.org/lang_datefunc.html#modifiers), e.g. + +```sql +datetime(ZCREATIONDATE, 'unixepoch', '31 years') +``` + +--- + Additional details about the Photos 5 database structure are [here](https://github.com/RhetTbull/osxphotos/wiki/Photos-version-5-database). Additional details about the Photos 4 database structure are [here](https://github.com/RhetTbull/osxphotos/wiki/Photos-version-4-database).