issue trying to copy dates

Started by bigfire60, February 14, 2025, 05:18:18 PM

Previous topic - Next topic

bigfire60

I'm running this command on a set of jpg files.
exiftool -m "ExifIFD:DateTimeOriginal<XMP-photoshop:DateCreated" 1956-001.jpg

This works fine when the XMP-photoshop:DateTime has a full date/time value.
If it only contains the date portion (ie: 1956:02:01) it reports the following error.

Warning: Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in ExifIFD:DateTimeOriginal (PrintConvInv) - 1956.001.jpg

Is there an easy way to resolve this?

StarGeek

EXIF time stamps normally need all the values of Year:Month:Day Hour:Minute:Second. You can force writing incomplete values with the hashtag # shortcut of the -n (--printConv) option.

exiftool "-DateTimeOriginal#<DateCreated" /path/to/files/

There is no guarantee that any other programs you use will read incomplete EXIF time stamps, so that is something to watch for.

Also see FAQ #5, How do I format date and time information for writing
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

bigfire60

Thanks for the reply StarGeek.
As you mentioned, it could prove to be problematic on some systems.
I've got a less-than-elegant solution that works but not optimal.
I can write the value out formatted to a file, which will add the placeholder time values of 0.
Then use this as input to a second exiftool command to assign the value to the tag.

exiftool -m -q -d "%%Y:%%m:%%d %%H:%%M:%%S" -XMP-photoshop:DateCreated  > tmpfile.txt

StarGeek

Ah, good catch. I don't think that operation has popped up before. And no need to copy to a text file, you can copy it directly.

C:\>exiftool -G1 -a -s -DateCreated y:\!temp\Test4.jpg
[XMP-photoshop] DateCreated                     : 1956

C:\>exiftool -P -overwrite_original -d "%Y:%m:%d %H:%M:%S" "-DateTimeOriginal<DateCreated" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -DateTimeOriginal -DateCreated y:\!temp\Test4.jpg
[ExifIFD]       DateTimeOriginal                : 1956:01:01 00:00:00
[XMP-photoshop] DateCreated                     : 1956
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

bigfire60


bigfire60

Any thoughts as to why if I copy the command into a batch(.bat) file, the
results of DateTimeOriginal are 1970:01:01 00:00:00 ?

StarGeek

FAQ #27, My ExifTool command doesn't work from a Windows .BAT file

My command was for the command line. Your command had the double % signs needed for a bat file.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

bigfire60