Sample Header Ad - 728x90

Getting "Date Added" attribute for a file with nanosecond precision

1 vote
0 answers
31 views
gstat can show several timestamps with **nanosecond precision**, including: - **Access time (atime)** - **Modify time (mtime)** - **Change time (ctime)** - **Birth time (btime)** Example output:
$ gstat /path/to/file
Access: 2025-01-14 08:25:18.137794004 +0100
Modify: 2025-01-14 08:25:18.120619368 +0100
Change: 2025-01-14 08:25:18.120619368 +0100
Birth:  2009-11-26 12:57:46.000000000 +0100
However, **Date Added is not included in gstat’s output.** Finder is able to sort files by **Date Added** even when multiple files are created within the same second, meaning macOS must store this attribute with sub-second precision. But I haven’t found a way to retrieve it. So far, the only ways I’ve found to get **Date Added** are: - **Finder list view** → Displays **minute-level precision** (e.g., *Dec 27, 2023 at 4:06 AM*). - **mdls** → Shows kMDItemDateAdded, but only with **second-level precision**:
$ mdls -name kMDItemDateAdded /path/to/file
  kMDItemDateAdded = 2023-12-27 09:06:44 +0000
How would I obtain the "Date Added" attribute for a file with nanosecond precision?
Asked by Oion Akif (9414 rep)
Mar 16, 2025, 06:48 PM
Last activity: Mar 17, 2025, 06:34 AM