Getting local time with "nonstandard" exif data

Started by Happy Hobo, November 07, 2023, 01:15:38 PM

Previous topic - Next topic

Happy Hobo

Trying to automate renaming/sorting of thousands of images when every camera/phone has its own idea of where to put UTC and local time.

I rename the files based on DateTimeOriginal, so when that is not there, I set it from something else.

But every time I run my script to update a group of images/videos, I find a new method.  Sometimes this means that the tag I was using to copy local time into DateTimeOriginal contains instead UTC or even some useless time like when someone cropped the image.

Some of the photos my sister took in Europe on a Microsoft Surface with "local" time still in Denver, Colorado.

Is there a shell script method to get the time zone offset from the lat/long and then use it with GPSDateTime to set DateTimeOriginal to local time?

Phil Harvey

...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 ($).

Happy Hobo

Yeah, I saw that SO item (and several others).  Unfortunately, an API can't be used off-line and is awkward to put in a shell script.  Several others might work, but I'd have to learn the language they're in to find out.

StarGeek

Part of the problem with an offline solution is that time zones are always changing.  And as usual, I'll take this opportunity to post my favorite Tom Scott video
The Problem with Time & Timezones - Computerphile
"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

Happy Hobo

Yes, time zone change (and daylight savings dates), but knowing the current time zone for a location will be correct often enough for me.  But I see that my recent photos have neither GPSDateTime nor GPSTimeStamp.  They do have OffsetTime, which can be subtracted from DateTimeOriginal to get GPSDateTime—except when DateTimeOriginal is missing!