How to change time only and keep the date

Started by mlino, September 09, 2024, 11:48:32 AM

Previous topic - Next topic

mlino

StarGeek edit: Split from this old thread

I'm trying to change only the date from an image and tried something similar to the abome mentioned, but it doesn't work.

exiftool -DateTimeOriginal"<${DateTimeOriginal;s/ 20240908/ .*/}" "_A9_7062_ILCE-9_E 17-28mm F2.8-2.8.ARW"
How can I do that?

Thanks!

Marcio

StarGeek

Your RegEx substitution is incorrect. You are using a simple string of numbers for your date and requiring a leading space. The date format is "Year:Month:Day Hour:Minute:Second", e.g. "2024:09:09 12:00:00". And you don't have a replacement value.

To change only the date, your command would be something like this
exiftool "-DateTimeOriginal<${DateTimeOriginal;s/2024:09:08/2022:03:14/}" "_A9_7062_ILCE-9_E 17-28mm F2.8-2.8.ARW"

But a Shift Time operation is usually better in cases like this. The command for that would be along these lines
exiftool -DateTimeOriginal±="Year:Month:Day 0" /path/to/files/

Replace ± with either a plus or minus sign, depending upon which way you want to shift the time. Replace each of Year/Month/Day with the amount you want to shift by, using 0 if you don't want to shift that at all. The trailing (space)0 (which represents the hour) is required because otherwise ShiftTime operation default to shifting hours.

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).