ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Stephen Marsh on July 20, 2016, 04:12:39 AM

Title: Date Discrepancy?
Post by: Stephen Marsh on July 20, 2016, 04:12:39 AM
ExifTool-10.23, Mac OS 10.11.5

Original file created 20th July 2016, 5:54:33 PM (reported in Photoshop)

Used the following command to add exif date metadata to a file that did not have exif metadata:

exiftool '-filemodifydate>datetimeoriginal' 'path/to/file/here.jpg'

The required info has been added to exif... However:

The date/time of the original is now 21st July 2016, 3:54:33 AM (reported in Photoshop)

Not sure why this has jumped forward in time?
Title: Re: Date Discrepancy?
Post by: Hayo Baan on July 20, 2016, 06:45:24 AM
You used the file modify date, that changes each time the file is changed. Run exiftool on the file to find out what datetime tag to use instead.
Title: Re: Date Discrepancy?
Post by: Stephen Marsh on July 20, 2016, 07:06:27 AM
OK, thanks Hayo, I thought that I did have the right field!

A different file...

exiftool -a -G1 -s

[System]        FileModifyDate                  : 2016:03:09 22:30:33+11:00
[System]        FileAccessDate                  : 2016:07:20 17:23:55+10:00
[System]        FileInodeChangeDate         : 2016:03:21 09:23:13+11:00

If a file has no XMP, EXIF etc... then I can only imagine that the system date is the correct one to use, where am I going wrong?

Is my assumption wrong? If there is no other metadata, then there is no original/created date?

Would I need to look for something OS specific, such as on the Mac:

kMDItemFSCreationDate

exiftool -a -G1 -s -api MDItemTags

[System]        MDItemContentCreationDate
Title: Re: Date Discrepancy?
Post by: Phil Harvey on July 20, 2016, 07:20:30 AM
Hi Stephen,

This looks to be a time zone problem since the two times reported by Photoshop are exactly 10 hours apart.

I would also recommend adding the -P option to preserve the original FileModifyDate when writing, but I don't think this is related to the difference that you are seeing in Photoshop.

For the files in your original post, what is the output of this command?:

exiftool -a -G1 -s -time:all 'path/to/file/here.jpg' 'path/to/file/here.jpg_original'

And yes, on a Mac the MDItemContentCreationDate may be what you should use.  However, if the file hasn't been modified then FileModifyDate should work fine (and I think it was probably OK for your first file).  Also note that MDItemContentCreationDate is only preserved when writing with ExifTool if -overwrite_original_in_place is used.

- Phil
Title: Re: Date Discrepancy?
Post by: Stephen Marsh on July 20, 2016, 09:00:17 PM
Thank you Phil.

I did not keep a copy of the original files, they were just something quickly knocked up for testing. Of course, I can't reproduce the issue now! :]

Moving on...

exiftool -P -overwrite_original_in_place '-MDItemContentCreationDate>datetimeoriginal' 'FILE'

Before Exiftool:

[System]        FileModifyDate                  : 2016:07:21 10:34:19+10:00
[System]        FileAccessDate                  : 2016:07:21 10:39:20+10:00
[System]        FileInodeChangeDate             : 2016:07:21 10:34:20+10:00
[IFD0]          ModifyDate                      : 2016:07:21 10:34:17
[XMP-xmp]       CreateDate                      : 2016:07:21 10:23:16+10:00
[XMP-xmp]       ModifyDate                      : 2016:07:21 10:34:17+10:00
[XMP-xmp]       MetadataDate                    : 2016:07:21 10:34:17+10:00


After Exiftool:

[System]        FileModifyDate                  : 2016:07:21 10:34:19+10:00
[System]        FileAccessDate                  : 2016:07:21 10:42:02+10:00
[System]        FileInodeChangeDate             : 2016:07:21 10:41:50+10:00
[IFD0]          ModifyDate                      : 2016:07:21 10:34:17
[ExifIFD]       DateTimeOriginal                : 2016:07:21 10:23:16
[XMP-xmp]       CreateDate                      : 2016:07:21 10:23:16+10:00
[XMP-xmp]       ModifyDate                      : 2016:07:21 10:34:17+10:00
[XMP-xmp]       MetadataDate                    : 2016:07:21 10:34:17+10:00


Looking in Photoshop, Bridge or Apple Preview – the file creation date and the newly created exif date/time original are correct: 2016-07-21 10:23:16

So it appears that this is correctly working now, thanks!
Title: Re: Date Discrepancy?
Post by: Stephen Marsh on July 20, 2016, 10:29:27 PM
Quote from: Phil Harvey on July 20, 2016, 07:20:30 AM
... And yes, on a Mac the MDItemContentCreationDate may be what you should use ...

- Phil


Hi Phil, if I was on Windows, what would be the options if there was no EXIF, XMP or other date/time metadata in the file? Unlike the Mac there is no OS specific extended metadata that I am aware of.

FileCreateDate is probably better from what Hayo was mentioning regarding FileModifyDate...
Title: Re: Date Discrepancy?
Post by: Hayo Baan on July 21, 2016, 01:06:09 AM
Indeed, on Windows you can use fileCreateDate instead of the MDItem... tag.