Setting FileModifyDate from DateTimeOriginal ignores time zone

Posted on 2009-01-07 15:28:17-08 by dtgriscom
Setting FileModifyDate from DateTimeOriginal ignores time zone
I have a pile of images that were taken in time zone GMT, but I'm currently in EST. I'd like to set the file modification date based on the DateTimeOriginal field. The obvious answer is to use '-DateTimeOriginal>FileModifyDate', but that assumes that DateTimeOriginal is specified in the current time zone, so everything gets shifted by five hours.

Is there a way to tell exiftool which time zone a file's timestamps should be interpreted in? Normally this doesn't matter because exif tags don't know about timezones, but file modification dates do.


Thanks,
Dan
Direct Responses: 9671 | Write a response
Posted on 2009-01-07 15:45:43-08 by exiftool in response to 9670
Re: Setting FileModifyDate from DateTimeOriginal ignores time zone
Interesting dilemma. I suggest a 2-step process:

exiftool '-DateTimeOriginal>fileModifyDate' FILE exiftool -fileModifyDate-=5

Alternatively, you could set your system timezone to GMT before setting the filemodifydate, then change it back again afterwards.

- Phil
Direct Responses: 9672 | Write a response
Posted on 2009-01-07 16:01:22-08 by dtgriscom in response to 9671
Re: Setting FileModifyDate from DateTimeOriginal ignores time zone
Good workaround.

May I suggest adding a new feature that addresses this? Something like

-timezone GMT

which would interpret all non-time-zoned times as being in EST. (Actually, it would probably work by being ignored for everything except for FileModifyDate, where it would be used to calculate an offset.)


Thanks,
Dan
Direct Responses: 9673 | Write a response
Posted on 2009-01-07 16:19:53-08 by exiftool in response to 9672
Re: Setting FileModifyDate from DateTimeOriginal ignores time zone
Hi Dan,

Wait. I just thought of something! ExifTool is too smart for me sometimes. You can also do this sort of thing:

exiftool '-fileModifyDate<$dateTimeOriginal+00:00' FILE

Brilliant!

No need for a new option.

- Phil
Direct Responses: 9674 | Write a response
Posted on 2009-01-07 17:05:50-08 by exiftool in response to 9673
Re: Setting FileModifyDate from DateTimeOriginal ignores time zone
I should mention that braces would be needed around "dateTimeOriginal" if the value was negative (since a dash is a valid character in a tag name), just in case someone out there tries to do this for pictures in a western time zone, ie)

exiftool '-fileModifyDate<${dateTimeOriginal}-08:00' FILE

And Windows users must use double quotes, not single quotes.

- Phil
Direct Responses: Write a response