ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Tom OReilly on April 19, 2020, 01:02:36 PM

Title: Possible to specify date/time offset in seconds?
Post by: Tom OReilly on April 19, 2020, 01:02:36 PM
I'm developing an automated image processing pipeline, which will adjust exif create/modify exif tags as needed. It's very easy to compute time offset in total seconds, not so easy to calculate  "yy:mm:dd HH:MM:SS". Since the pipeline is automated I want to avoid need to use online date offset calculators. Is it possible to specify offset in total seconds to exiftool? If not, can you point me to algorithms that compute  "yy:mm:dd HH:MM:SS" taking leap years properly into account?
Thanks!
Title: Re: Possible to specify date/time offset in seconds?
Post by: StarGeek on April 19, 2020, 01:10:18 PM
Yes, you can shift time in seconds.  You just need to make sure that fill the hour:minutes with zeroes because otherwise exiftool will assume the number is hours.

For example, shifting the DateTimeOriginal by 5 hours
exiftool -DateTimeOriginal+=0:0:18000 file.jpg

See Image::ExifTool::Shift.pl (https://exiftool.org/Shift.html) for more details.
Title: Re: Possible to specify date/time offset in seconds?
Post by: Tom OReilly on April 19, 2020, 01:12:42 PM
Ah, just figured it out. Yes it is easy to specify offset to exiftool as total seconds by leaving year, month, day, hours and minutes as '0'. E.g. to specify a three-year offset:

exiftool "-ModifyDate+=0:0:0 0:0:94608000" -verbose DSC00006.JPG


Thanks!
Title: Re: Possible to specify date/time offset in seconds?
Post by: Tom OReilly on April 19, 2020, 01:13:32 PM
Awesome - thank you StarGeek!