How to sort contacts by creation date or modification date in iOS Contacts or OS X Contacts 7.x?
Is there a way to view or export the date a contact was created or modified in iOS 7 and/or the Contacts app (version 7.1) when viewed from a Mac?
This one datapoint would enormously aid deduping and syncing, even in a more manual way.
Solution 1:
After digging a little bit in Contacts
' DB here is what I found.
As already said by @grgarside, the DB is in
~/Library/Application\ Support/Address\ Book/Sources/<source-ID>/AddressBook-v22.abcddb
Where <source-ID>
is most likely the most recent modified directory.
AddressBook-v22.abcddb
is a SQLite DB file with 24 tables (in my case). The most important one is ZABCDRECORD
which holds (among others) the firstname, lastname and the creation date of the contact (but also modification etc).
The 2 interesting columns in your case are :
- ZCREATIONDATE
- ZMODIFICATIONDATE
As I found out recently, the base date for these 2 columns is 01-01-2001.
The columns ZMODIFICATIONDATEYEARLESS
and ZCREATIONDATEYEARLESS
use the 1st January of creation year as the base date.
Using sqlite
you can sort it like that :
sqlite3 AddressBook-v22.abcddb "select ZFirstName, ZLastName from ZABCDRECORD order by ZMODIFICATIONDATE"
It will output FirstName/LastName sorted by modification date.
Solution 2:
The Contacts database is stored in a single SQLite3 database. You can find yours here…
~/Library/Application\ Support/AddressBook/Sources/<source-ID>/AddressBook-v22.abcddb
This can be exported using
sqlite3 AddressBook-v22.abcddb .dump > ~/Desktop/export
Since the result is a single file and created/modified dates don't appear to be stored in my database, the only way to sort by date is by comparing various versions of the file.
You can use Time Machine to grab older versions of the file and FileMerge (a developer tool) or other comparison tool such as Kaleidoscope to compare the result.
If you want to look through your iOS database, either jailbreak or sync your contacts to your Mac.