ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: philbond87 on April 27, 2022, 09:25:53 AM

Title: Time shifting... but hours and minutes in opposite directions
Post by: philbond87 on April 27, 2022, 09:25:53 AM
It seems that -AllDates takes an hr:min:sec string but shifts the time all in one direction based on that string,

exiftool -overwrite_original -AllDates+=03:15:05

Is that correct?

I've tried adding signs to the time string (eg. "03:-15:05") in order to add three hours and subtract 15 minutes but that didn't seem to work, as it appears only to consider the += or -= and apply it to all of the values.

I also tried doing each (hr, min, sec) as separate -AllDates+= or -AllDates -= commands... all in the same line... but then it only appears to shift the last command in the line.

exiftool -AllDates+=03 -AllDates-=15 -AllDates+=5

Would I have to do it in three separate passes?

Thanks,
Phil
Title: Re: Time shifting... but hours and minutes in opposite directions
Post by: StarGeek on April 27, 2022, 09:46:01 AM
You have to do the math first if you don't want to do them separately.  So you would use
-AllDates+=2:45:05
or convert the hours to minutes first
-AllDates+=0:165:05

For more details, see ExifTool Date/Time Shift Module (https://exiftool.org/Shift.html).

Quote from: philbond87 on April 27, 2022, 09:25:53 AM
I also tried doing each (hr, min, sec) as separate -AllDates+= or -AllDates -= commands... all in the same line... but then it only appears to shift the last command in the line.

exiftool -AllDates+=03 -AllDates-=15 -AllDates+=5

See Note #1 under the -TAG[+-^]=[VALUE] option (https://exiftool.org/exiftool_pod.html#TAG---VALUE).
Title: Re: Time shifting... but hours and minutes in opposite directions
Post by: philbond87 on April 27, 2022, 09:49:36 AM
@StarGeek, got it – thanks!