How to fix timezone of images using exiftool


I received some photos from a photographer.
When I use exiftool I discover that the timezone of the photographer's camera was incorrect.

Create Date                     : 2024:04:21 05:40:41-05:00
Date/Time Original              : 2024:04:21 05:40:41-05:00
Modify Date                     : 2024:04:21 13:08:27+07:00

Date/Time Created               : 2024:04:21 05:40:41-05:00
Digital Creation Date/Time      : 2024:04:21 05:40:41-05:00

The correct timezone is UTC+7:00 (Indochina Time (ICT)), but several exif fields incorrectly have -05:00.

The date and time is otherwise correct. For example, the Create Date should be 2024:04:21 05:40:41 but in UTC+7:00 Indochina time. (The Modify Date is when I assume the photographer edited the photos using photo editing software).

How can I use exiftool to correct the timezone of the fields which have -5:00?

And additionally I would like to set the File Create and Modify date to match the exif Create Date.

Here's a more complete exiftool output in case it's helpful:

$ exiftool -time:all -G1 -a -s DSC00907.jpg                  
[System]        FileModifyDate                  : 2024:04:21 05:40:41+07:00
[System]        FileAccessDate                  : 2024:04:24 19:15:59+07:00
[System]        FileInodeChangeDate             : 2024:04:24 19:15:59+07:00
[IFD0]          ModifyDate                      : 2024:04:21 13:08:27
[ExifIFD]       DateTimeOriginal                : 2024:04:21 05:40:41
[ExifIFD]       CreateDate                      : 2024:04:21 05:40:41
[ExifIFD]       OffsetTime                      : +07:00
[ExifIFD]       OffsetTimeOriginal              : -05:00
[ExifIFD]       OffsetTimeDigitized             : -05:00
[XMP-xmp]       ModifyDate                      : 2024:04:21 13:08:27+07:00
[XMP-xmp]       CreateDate                      : 2024:04:21 05:40:41-05:00
[XMP-xmp]       MetadataDate                    : 2024:04:21 13:08:27+07:00
[XMP-photoshop] DateCreated                     : 2024:04:21 05:40:41-05:00
[XMP-xmpMM]     HistoryWhen                     : 2024:04:21 13:08:27+07:00
[IPTC]          DateCreated                     : 2024:04:21
[IPTC]          TimeCreated                     : 05:40:41-05:00
[IPTC]          DigitalCreationDate             : 2024:04:21
[IPTC]          DigitalCreationTime             : 05:40:41-05:00
[ICC-header]    ProfileDateTime                 : 1998:02:09 06:49:00
[Composite]     SubSecCreateDate                : 2024:04:21 05:40:41-05:00
[Composite]     SubSecDateTimeOriginal          : 2024:04:21 05:40:41-05:00
[Composite]     SubSecModifyDate                : 2024:04:21 13:08:27+07:00
[Composite]     DateTimeCreated                 : 2024:04:21 05:40:41-05:00
[Composite]     DigitalCreationDateTime         : 2024:04:21 05:40:41-05:00

Best Answer

In the above output, you can completely ignore the ProfileDateTime, MetadataDate, and HistoryWhen. The first applies only to the ICC_Profile color data and isn't something that should be changed. The other two are workflow tags and should never be used to date the image. These should automatically be updated whenever the file is modified, though this is dependent upon the program used. For example, Adobe programs will always update these, but many less professional programs will not.

The Composite group tags are tags that exiftool creates on the fly to facilitate copying data between tags/groups/files. They do not actually exist in the file. They can be ignored, as they will change when the underlying tags that they read are corrected.

The IFD0:ModifyDate/XMP-xmp:ModifyDate/ExifIFD:OffsetTime tags can be ignored, as they fall into a similar category as the MetadataDate/HistoryWhen tags. They are supposed to be changed whenever the image is modified. If the other more important date/time tags are missing, programs might use these to date image, so this comes down to a personal preference. If desired, these can be fixed as outlined below.

The actual important tags are the remaining OffsetTime tags, the DateTimeOriginal, DateCreated, and two CreateDate tags. And to a lesser degree, the DigitalCreationTime/TimeCreated tags.

To fix the time zones, exiftool's ShiftTime ability is used. To shift from -05:00 to +07:00, a shift of +12 hours is needed. The basic format for this is


The resulting command would be

exiftool -OffsetTimeOriginal+=+12:00 -OffsetTimeDigitized+=+12:00 -CreateDate+=+12:00 -DateCreated+=+12:00 -DigitalCreationTime+=+12:00 -TimeCreated+=+12:00 /path/to/files/

If desired, the modify type tags can be added to this command using the same format.

This command creates backup files. Add -overwrite_original to suppress the creation of backup files. Add -r to recurse into subdirectories. Add the -P (-preserve) option to preserve the current FileModifyDate.

The file system tags are the only tags left. These tags are stored as UTC and the file system shifts them to the local time zone when extracted. As such, they will always appear in local time, which won't be the same if the image was taken in a different time zone.

Exiftool cannot edit the FileAccessDate/FileInodeChangeDate tags, and there is no reason to try to as these will constantly update whenever the file/directory it is in is touched.

The FileModifyDate is similar to the modify dates above, but applies to when the file is modified in any way, not just the image.

Related Question