I have a lot of photos from old phone, which exif date and time format is "30.11.2008 00.48.17", time separated by dot not colon. So, exiftool says "Warning: Month '17' out of range 1..12" for example.
How to fix it?
Exiftool has an option to change date format in commands: -d "%d.%m.%Y %H.%M.%S"
Quote from: greybeard on December 12, 2023, 07:58:23 AM-d "%d.%m.%Y %H.%M.%S"
Thank you. I tried to convert dates with command:
exiftool "-CreateDate<DateTimeOriginal" -d "%d.%m.%Y %H.%M.%S" D:\photos\*but got message:
Warning: No writable tags set from
and all files remained unchanged.
what is wrong?
What is the output of this command?
exiftool -time:all -G1 -a -s file.jpg
Quote from: StarGeek on December 12, 2023, 10:41:26 AMWhat is the output of this command?
exiftool -time:all -G1 -a -s file.jpg
[System] FileModifyDate : 2016:12:24 14:45:32+01:00
[System] FileAccessDate : 2023:12:12 00:00:00+01:00
[System] FileCreateDate : 2023:12:12 17:39:35+01:00
[ExifIFD] DateTimeOriginal : 01.06.2009 21.52.38
[ExifIFD] CreateDate : : : : :
You'll want to fix the DateTimeOriginal as well as copying to CreateDate Try this. If you're using Mac/Linux, change the double quotes to single quotes. On Windows, use CMD instead of PowerShell.
exiftool "-AllDates<${DateTimeOriginal;s/^(\d\d)\.(\d\d)\.(\d{4})/$3:$2:$1/}" /path/to/files/
Example
C:\>exiftool -G1 -a -s -alldates y:\!temp\Test4.jpg
[ExifIFD] DateTimeOriginal : 01.06.2009 21.52.38
C:\>exiftool -P -overwrite_original "-AllDates<${DateTimeOriginal;s/^(\d\d)\.(\d\d)\.(\d{4})/$3:$2:$1/}" y:\!temp\Test4.jpg
1 image files updated
C:\>exiftool -G1 -a -s -alldates y:\!temp\Test4.jpg
[ExifIFD] DateTimeOriginal : 2009:06:01 21:52:38
[ExifIFD] CreateDate : 2009:06:01 21:52:38
[IFD0] ModifyDate : 2009:06:01 21:52:38
Apologies for confusing things - I guess the date format (-d) just formats the output when the internal date is correctly stored.
Quote from: greybeard on December 12, 2023, 12:34:09 PMI guess the date format (-d) just formats the output when the internal date is correctly stored.
Yes, I had to double-check that.
Quote from: greybeard on December 12, 2023, 12:34:09 PMApologies for confusing things - I guess the date format (-d) just formats the output when the internal date is correctly stored.
No. This would have worked but you need to set
-api strictdate=0, otherwise improper date/time values aren't copied.
With
-api strictdate=0 the extracted invalid date/time is passed through unformatted, and the
-d reformatting is applied to convert the value back when writing.
We recently had another topic (https://exiftool.org/forum/index.php?msg=83054) with this same problem.
Read here (http://exiftool.org/ExifTool.html#StrictDate) for details about the API StrictDate option.
- Phil
Quote from: StarGeek on December 12, 2023, 12:13:14 PMexiftool "-AllDates<${DateTimeOriginal;s/^(\d\d)\.(\d\d)\.(\d{4})/$3:$2:$1/}" /path/to/files/
Such good advice! Thank you so much, everything works well!
Just to show the results of greybeard's command with Phil's recommendation
C:\>exiftool -time:all --system:all -G -a -s y:\!temp\Test4.jpg
[EXIF] DateTimeOriginal : 30.11.2008 00.48.17
C:\>exiftool -api strictdate=0 -d "%d.%m.%Y %H.%M.%S" "-CreateDate<DateTimeOriginal" y:\!temp\Test4.jpg
1 image files updated
C:\>exiftool -time:all --system:all -G -a -s y:\!temp\Test4.jpg
[EXIF] DateTimeOriginal : 30.11.2008 00.48.17
[EXIF] CreateDate : 2008:11:30 00:48:17