Changing timezone on CRW raw files

Started by aperturemode, November 20, 2023, 05:51:19 PM

Previous topic - Next topic

aperturemode

For JPG files, I have been adding timezones with the offset tags (exif:OffsetTimeDigitized, exif:OffsetTime, and -exif:OffsetTimeOriginal) using the shortcut command:

exiftool '-exif:offsettime*=-05:00' *.JPG

It seems to me that raw files don't used these 'offset' tags either in the CRW or XMP (sidecar) files?

Interesting although I didn't set any time zones on camera, as the raw file itself shows 0 for the timezone Makernotes,

[MakerNotes:CanonRaw] TimeZoneCode              : 0
[MakerNotes:CanonRaw] TimeZoneInfo              : 0


timezone still showed up in my XMP sidecar files (perhaps added by Lightroom?):

[XMP:XMP-exif]  DateTimeOriginal                : 2007:07:23 17:19:42-05:00
[XMP:XMP-xmp]   CreateDate                      : 2007:07:23 17:19:42-05:00
[XMP:XMP-xmp]   ModifyDate                      : 2007:07:23 17:19:42-05:00

However, the timezones are wrong so I would like to correct them. How and in which tag would I do that?



StarGeek

XMP sidecar files can only hold XMP data, while the TimeZoneOffset* tags are EXIF data.

XMP time stamps don't use a separate tag to hold the time zone.  It is included in the tag, as shown in your output.

If you know the difference needed to correct the time zone, you can shift the time.  For example, if the time zone was set to -08:00 West Coast US, but the pictures were taken on the East Coast -05:00, you would have to add three hours.
exiftool -DateTimeOriginal+=+03:00 /path/to/files/
or if it was the reverse, -05:00 time zone but needed to be -08:00
exiftool -DateTimeOriginal+=-03:00 /path/to/files/

This does require exiftool ver 12.49+

Otherwise you could either rewrite the whole date.  Taking the value from your example output
exiftool -DateTimeOriginal="2007:07:23 17:19:42-08:00" /path/to/files/

A more complex command would be to use the -TagsFromFile option and a regular expression
exiftool -TagsFromFile @ "-DateTimeOriginal<${DateTimeOriginal;s/-05:00/-08:00/}" /path/to/files/

Personally, I'd recommend the shifting option.

Also, you can use the AllDates shortcut to modify the three most commonly used time stamps at once
exiftool -AllDates+=+03:00 /path/to/files/

You would have to add any other date/time tags to the command separately.  Use this command to see all the date/time tags in the file
exiftool -time:all -G1 -a -s /path/to/files/

You can ignore the MakerNotes tags if you want, as there are almost no programs that read that data.  I'm not sure what values those Canon time zone tags hold, so you'd have to experiment with that.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

aperturemode

Thanks for the great explanation and various options to correct the dates.

I think in this instance, I may try the -TagsFromFile option and a regular expression as it seems the actual local time is correct  but the timezone is off. Is it possible to use the -alldates with this approach or better to change each date tag individually, per your example?

Phil Harvey

Quote from: aperturemode on November 20, 2023, 08:33:32 PMIs it possible to use the -alldates with this approach or better to change each date tag individually, per your example?

The string substitution won't when using a ShortCut tag as the source, so you need separate arguments for each tag you want to change.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

Ah, the -api Filter option works

C:\>exiftool -G1 -a -s -alldates y:\!temp\Test4.jpg
[XMP-exif]      DateTimeOriginal                : 2023:11:20 12:00:00-05:00
[XMP-xmp]       CreateDate                      : 2023:11:20 12:00:00-05:00
[XMP-xmp]       ModifyDate                      : 2023:11:20 12:00:00-05:00

C:\>exiftool -P -overwrite_original -api "Filter=s/-05:00/-08:00/" -TagsFromFile @ -XMP:AllDates y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -alldates y:\!temp\Test4.jpg
[XMP-exif]      DateTimeOriginal                : 2023:11:20 12:00:00-08:00
[XMP-xmp]       CreateDate                      : 2023:11:20 12:00:00-08:00
[XMP-xmp]       ModifyDate                      : 2023:11:20 12:00:00-08:00
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

aperturemode