3

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?

3 Answers 3

5

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.

0

Documentation and Forums have many details, but a simple answer is

exiftool -datetimeoriginal="2022:10:23 17:40.00" <filename>

For October 23rd, 2022, 5:40pm. However, this does not set timezone.

0

Hopefully clarifying the mud, .

How to set an image's date, time and timezone using ExifTool

One issue to overcome is the fact that the EXIF standard has individual tags for

date/time (EXIF:DateTimeOriginal) subseconds (EXIF:SubSecTimeOriginal) time zone (EXIF:OffsetTimeOriginal)

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

You would use the SubSecDateTimeOriginal tag, as in ...

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

This will write the following data to their respective tags.

2022:12:12 12:00:00 → EXIF:DateTimeOriginal 24 → EXIF:SubSecTimeOriginal -08:00 → EXIF:OffsetTimeOriginal

Notice above, that SubSecDateTimeOriginal is NOT prepended with the Group name, -EXIF:

Also of note are the SubSecCreateDate and SubSecModifyDate tags.

SubSecCreateDate writes to the following three tags.

EXIF:CreateDate ← called DateTimeDigitized by the EXIF spec. EXIF:SubSecTimeDigitized EXIF:OffsetTimeDigitized

SubSecModifyDate writes to the following three tags.

EXIF:ModifyDate ← called DateTime by the EXIF spec. EXIF:SubSecTime EXIF:OffsetTime

There is also the XMP standard, which (as well as explicitly stating the metadata commands on the command-line), has a dedicated file, a so-called 'XMP sidecar' file, from which the commands can be read. Although not promoted 'up-front', Exiftool also has this capability.

The command for writing to an XMP tag is similar to that of writing to an EXIF tag, in that the date/time, subseconds and timezone can all be written using the single tag DateTimeOriginal

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

Notice here, that DateTimeOriginal is prepended with the Group name, -XMP: Additional tags for using with XMP would be XMP:CreateDate and XMP:ModifyDate

One final thing that you should be aware of when writing XMP time-stamps, is that, while EXIF:DateTimeOriginal is the date and time that the original image was shot/taken, differing standards that employ XMP will utilise their own tags for this purpose, specifically ...

Exif 2.32 metadata for XMP standard will use XMP:DateTimeOriginal

IPTC Photo Metadata Standard 2022.1 will use XMP:DateCreated

Excluding the timezone, a simpler command to just set the date & time for an image to October 23rd, 2022 at 5:40pm, would be ...

exiftool -datetimeoriginal="2022:10:23 17:40.00"

In this example, notice that 'datetimeoriginal' is not prepended with any Group name.

Group Priorities ExifTool prioritises the following types of meta information when writing:

  1. EXIF, 2) IPTC, 3) XMP

Many tag names are valid for more than one of these groups. If a group name is not specified when writing information, then the information is added only to the highest priority group for which the tag name is valid, (however, the information is updated in all groups where the tag already existed). The priority of the groups is given by the list above.

Specifically, this means that new information is added preferentially to the EXIF group, or to the IPTC group if no corresponding EXIF tag exists, or finally to the XMP group.

Alternatively, information may be written to a specific group only, bypassing these priorities, by providing a group name for the tag.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .