Possible to specify date/time offset in seconds?

Started by Tom OReilly, April 19, 2020, 01:02:36 PM

Previous topic - Next topic

Tom OReilly

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!

StarGeek

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 for more details.
"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

Tom OReilly

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!

Tom OReilly