ExifTool – How to Set an Image’s Date and Time with Timezone


ExifTool is a powerful tool for modifying meta data on images. What is the simple command line to specify the date and time for an image?

Best Answer

One problem is the fact that the EXIF standard separates the date/time (EXIF:DateTimeOriginal) and the time zone (EXIF:OffsetTimeOriginal) into different tags. The subseconds (EXIF:SubSecTimeOriginal) are also located in a different tag.

Luckily, exiftool gives you a shortcut to write all three locations in a single command. You would use

exiftool -SubSecDateTimeOriginal="2022:12:12 12:00:00.24-08:00" /path/to/files/

This will write 2022:12:12 12:00:00 to the EXIF:DateTimeOriginal, 24 to the EXIF:SubSecTimeOriginal, and -08:00 EXIF:OffsetTimeOriginal at the same time.

Also of note are the SubSecCreateDate and SubSecModifyDate tags.

SubSecCreateDate writes to the EXIF:CreateDate (called DateTimeDigitized by the EXIF spec), EXIF:SubSecTimeDigitized, and the EXIF:OffsetTimeDigitized tags. SubSecModifyDate writes to the EXIF:ModifyDate (called DateTime by the EXIF spec), EXIF:SubSecTime, and the EXIF:OffsetTime tags.

There is also the XMP standard, which is much more flexible. It can either be embedded in the file or as an XMP sidecar. The XMP standard allows for all the data in a single tag. The command for writing to an XMP tag would be similar

exiftool -XMP:DateTimeOriginal="2022:12:12 12:00:00.24-08:00" /path/to/files/

Additional tags for XMP would be XMP:CreateDate and XMP:ModifyDate

One final thing to take note of for the XMP time stamps is that the Exif 2.32 metadata for XMP standard uses XMP:DateTimeOriginal as the corresponding tag for EXIF:DateTimeOriginal, while the IPTC Photo Metadata Standard 2022.1 uses the XMP:DateCreated as the corresponding tag.

Related Question