Incorrect GPSDateTime - how to fix it?

Started by g93uu7w, January 27, 2019, 08:18:23 AM

Previous topic - Next topic

g93uu7w

Somehow almost my entire photo collection suddenly has corrupt GPSDateTime values. I don't know when or how this happened, as all backups as far as a year ago seem to have this set. I guess it never occured or bothered me until Android Gallery app started using this field to sort pictures. Pictures from the last few months are fine.

exiftool.exe -s -*date* -*time* IMG_20170816_134513.jpg
FileModifyDate                  : 2018:04:01 09:27:39+02:00
FileAccessDate                  : 2019:01:27 12:40:23+01:00
FileCreateDate                  : 2019:01:27 12:40:23+01:00
ModifyDate                      : 2017:08:16 13:45:13
DateTimeOriginal                : 2017:08:16 13:45:13
CreateDate                      : 2017:08:16 13:45:13
GPSDateStamp                    : 2038:01:19
GPSDateTime                     : 2038:01:19 03:14:07Z
SubSecCreateDate                : 2017:08:16 13:45:13.266738
SubSecDateTimeOriginal          : 2017:08:16 13:45:13.266738
SubSecModifyDate                : 2017:08:16 13:45:13.266738
ExposureTime                    : 1/875
DateTimeOriginal                : 2017:08:16 13:45:13
SubSecTime                      : 266738
SubSecTimeOriginal              : 266738
SubSecTimeDigitized             : 266738
GPSTimeStamp                    : 03:14:07
GPSDateTime                     : 2038:01:19 03:14:07Z
SubSecDateTimeOriginal          : 2017:08:16 13:45:13.266738


I've been trying for hours to figure out how to correct this. I figured I'd compare gpsdatetime to "2038:01:19 03:14:07Z", but my if comparison always fails, example:
exiftool.exe -gpsdatetime -if '$gpsdatetime="2038:01:19 03:14:07Z"' *.jpg

I guess it didn't matter, let's just set the date and be done with it, but that also fails:
exiftool.exe -alldates=$datetimeoriginal test.jpg
exiftool.exe -alldates=$datetimeoriginal -d "%Y:%M:%d %H:%M:%S" test.jpg
exiftool.exe -alldates=$datetimeoriginal -d "%Y:%M:%d %H:%M:%S|%Z" test.jpg
Always comes back with the same warning:
Warning: Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in IFD0:ModifyDate (PrintConvInv)

I'm reading, searching, spent the better part of this day trying to work out how this works but I'm not getting anywhere. Above are just a few examples, I tried using quotes and different date formats.

I'd really appreciate it if some kind soul could give me the correct commands to fix this?

Thank you.

Phil Harvey

First, the "=" operator compares numbers.  Use "eq" to compare as strings.

Second, the AllDates tag only changes DateTimeOrginal, ModifyDate and CreateDate.  You should try writing GPSDateStamp directly.

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

StarGeek

Also Common Mistake #5c.  Using the equal sign assigns the string value "$datetimeoriginal", not the datetime contained in the tag.  You want to use the Greater/Less than sign </> to copy a tag value.

Also remember that GPS time is supposed to be UTC.  Shouldn't be too big of a deal for you if that's off, though, since you're so close to UTC anyway.

To check to see if the file is in the future like this, you could use an if statement like:
-if '$GPSDateTime gt "2019"'
"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

g93uu7w

Thank you both for the help.

I'll give it a swirl later this week.