Change TIME only in DateTimeOriginal

Started by templar701, February 09, 2018, 08:10:34 PM

Previous topic - Next topic

templar701

Hi all,

I would be grateful for any help.  I'm trying to run a script that changes just the time element of DateTimeOignial, using advanced formatting, but I'm a bit of a novice with Perl and it seems to be off. 

For example:

I want to change just the time (not the date) to a fixed value of 14:05:07 for DateTimeOriginal.

exiftool '-DateTimeOriginal<14:05:07 ${DateTimeOriginal;s/ .*//}' FILE

The above removes the time element completely.

I tried to search for a solution initially, but all I could find was this thread, which changes the DATE only in DateTimeOignial :
https://exiftool.org/forum/index.php/topic,5517.0.html
where Phil gave this code example
exiftool '-datetimeoriginal<2014:03:02 ${datetimeoriginal;s/.* //}' FILE

Many thanks

StarGeek

You're very close.  You correctly removed the time, which would leave only the date.  The problem is you are putting the time in front of the date.

Try this:
exiftool '-DateTimeOriginal<${DateTimeOriginal;s/ .*//} 14:05:07' FILE
* 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).

templar701

Ah many thanks, that works great StarGeek!