FolderItem.ModificationDate vs Last Opened date

I’m tracking a file that I need to know when it’s been updated, by checking FolderItem.ModificationDate.

What I’m seeing is very odd:

  • In Terminal (using ls -lag) the file shows the modification date as 11:52am
  • In Xojo: the modification date is 11:49am
  • In the Finder in List view, the file shows Date Modified as 11:49am
  • In the Finder, going Get Info on the file also shows Date Modified as 11:49am, but shows the Last Opened date as 11:52am.

Since this file is an sqlite3 database, it looks like I need the “last opened” date rather than the “last modified” date.

How does one get that?

The last opened date is stored in the metadata kMDItemLastUsedDate property.
You can check it using the mdls command.
Can probably read it using xattr
xattr -l
or xattr -p file

Thanks Norman - on further investigation it looks as if it’s actually not the last access date, but the modification date, wherein both Xojo and the Finder can get “out of sync” with the value as seen in Terminal.

Given that the Finder is also showing the “old” data, I don’t think this is a Xojo bug, but I’m wondering if there is a workaround.