ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: perforsberg on August 20, 2022, 08:47:15 AM

Title: Invalid time string when shifting DateTimeOriginal
Post by: perforsberg on August 20, 2022, 08:47:15 AM
Hi,

I get this error message when trying to change creation date on some jpg images. It works for all images, except those with original time stamp where seconds is one digit, e.g 10:30:05. It looks like exiftool think that zero is a white space. Then I get this error message:

"Warning: Invalid time string (2022:07:11 10:30: 5) when shifting DateTimeOriginal".
I´m using this terminal command:

exiftool "-DateTimeOriginal-=43:01:0 0:0:0" -IPTC:Caption-Abstract="My description" "-filemodifydate<datetimeoriginal" -overwrite_original /Path/To/My/Folder
I guess it´s a bug?

I´m on MacOS 12.5.1 with exiftool 12.44
Title: Re: Invalid time string when shifting DateTimeOriginal
Post by: Alan Clifford on August 20, 2022, 09:10:06 AM
Is "2022:07:11 10:30: 5" the original datetimeoriginal?  That is, with the space?
Title: Re: Invalid time string when shifting DateTimeOriginal
Post by: greybeard on August 20, 2022, 10:01:25 AM
Alan is probably correct - you have incorrectly formatted dates in your images.

exiftool may be able to fix them up - something like:

exiftool "-DateTimeOriginal<datetimeoriginal" xxx.jpg
(Test thoroughly before you try on your production files)
Title: Re: Invalid time string when shifting DateTimeOriginal
Post by: StarGeek on August 21, 2022, 12:41:58 PM
Quote from: greybeard on August 20, 2022, 10:01:25 AMexiftool "-DateTimeOriginal<datetimeoriginal" xxx.jpg

Works correctly here
C:\>exiftool -G1 -a -s -DateTimeOriginal y:\!temp\Test4.jpg
[ExifIFD]       DateTimeOriginal                : 2022:07:11 10:30: 5

C:\>exiftool -P -overwrite_original "-DateTimeOriginal<DateTimeOriginal" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -DateTimeOriginal y:\!temp\Test4.jpg
[ExifIFD]       DateTimeOriginal                : 2022:07:11 10:30:05