Warning: Invalid date/time - Docs, forums, posts suggest it should work.

Started by ConfusedGuy818, February 05, 2023, 11:21:02 AM

Previous topic - Next topic

ConfusedGuy818

I'm trying to write a date into the EXIF DateTimeOriginal tag, but I keep getting this error message:

Warning: Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in ExifIFD:DateTimeOriginal (PrintConvInv)
I have searched the docs, forums, ChatGPT, etc. I still don't see how my date is formatted incorrectly.

Here is the command I am trying to run:

> exiftool -DateTimeOriginal=FileModifyDate -d "%Y:%m:%d %H:%M:%S" 20220801_105606.JPG
To check the format I run this:
>exiftool -FileModifyDate -d "%Y:%m:%d %H:%M:%S" 20220801_105606.JPG
I get:
File Modification Date/Time     : 2022:08:01 10:56:06
Is that not the proper format? Why won't that value get set into -DateTimeOriginal?

The docs say: "The standard EXIF date/time format is "YYYY:mm:dd HH:MM:SS"

Even Phil has posted comments that suggest my format should work. See:
#https://exiftool.org/forum/index.php?topic=5187.0
> exiftool -xmp:dateTimeOriginal='2013:08:06 10:08:06' test.jpg
Can someone please help me understand why my dateformat is incorrect?

Thank you!


StarGeek

Quote from: ConfusedGuy818 on February 05, 2023, 11:21:02 AMHere is the command I am trying to run:

> exiftool -DateTimeOriginal=FileModifyDate -d "%Y:%m:%d %H:%M:%S" 20220801_105606.JPG

This is Common Mistake #5c.  When copying a tag, you use the Less Than sign <  When using an equal sign, you are assign a date/time tag with the value of "FileModifyDate", not the value of the FileModifyDate tag.

Also, because the Less Than sign has a special meaning on the command line, you need to put quotes around that part of the command.

You also don't need to use the -d (-dateFormat) option, as the FileModifyDate is already a date/time tag and will copy directly.  It's would be a better habit not to include it, as the -d option would interfere with the copy if the format was not a regular YearMonthDayHourMinuteSecond sequence.

Try
exiftool "-DateTimeOriginal<FileModifyDate" 20220801_105606.JPG
* 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).

ConfusedGuy818

Thank you for your reponse! I've been struggling with the < vs = issue, and I nearly appended that to my question, but I thought it was tangential to the issue at hand. I even Googled and searched the site for < instances and didn't find anything. I thought they were interchangeable!

I feel like the documentation needs to starts with basics like this and then add complexity. Despite hours of reading the docs/forums I've never seen this issue explained.

Thanks again!

Phil Harvey

The application documentation explains the command-line syntax in detail, with examples, although the explanation of the "<" operation is quite far down in the description of the -tagsFromFile redirection feature.  (You are implicitly using -tagsFromFile @ when you copy one tag value to another.)  For shell users, the "<" should make perfect sense because in a shell command this is a pipe from the contents of a file.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).