Mixing time formats when trying to apply date from json

Started by Spadez, February 08, 2020, 06:07:17 AM

Previous topic - Next topic

Spadez

Hello,

I'm on a Mac with the latest version of exliftools. I've been trying to read the guides and stack overflow to get my head around this. I'm trying to set the created time of the file from a corresponding JSON file. Notably this good stake overflow post by star geek:

https://stackoverflow.com/questions/42024255/bulk-join-json-with-jpg-from-google-takeout

My setup is such (Google Takeout):

IMG_1464.JPG.json
CreationTimeFormatted           : Aug 4, 2016, 9:16:06 PM UTC
CreationTimeTimestamp           : 1470345366

IMG_1464.JPG
CreateDate                      : 2016:08:04 00:00:00

Code:
exiftool -tagsfromfile '%d/%F.json' '-createdate<CreationTimeTimestamp' -progress -r -P .

Result:
Warning: Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in ExifIFD:CreateDate (PrintConvInv) - ./IMG_1464.JPG.json
Warning: No writable tags set from ./IMG_1464.JPG.json
    1 directories scanned
    0 image files updated
    1 image files unchanged


I'm a bit confused because I don't have the date in that format in my json? Looking at FAQ item 5 I still don't understand, and using things like XML doesn't seem to change it.

Thank you.

Phil Harvey

You must set to the date/time format using the -d option to be able to input either of these formats.  The easiest would be CreationTimeTimestamp:

exiftool -tagsfromfile '%d/%F.json' '-createdate<CreationTimeTimestamp' -d %s -progress -r -P .

See here for a list of -d format codes.

- 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

I really should go back and update that answer.

The first thing you should check is to see if you actually need to copy the data from the json file.  In my experience, Google does not alter the metadata in the files that you download.  So unless you changed some data through the website, you shouldn't have to actually copy data from the json files.  This is especially problematic for date/time stamps because the time Google places in the json file is in UTC and how Google decides what the time offset to apply to make it UTC is a complete mystery to me.  Even though I'm on the West coast US, I've seen Google apply a -5:00/-4:00 East coast time zone to the time stamp as well as the correct West coast time zone.

Your example does show that the time part of the CreateDate is probably incorrect.  It's up to you if the UTC time is good enough, but if you want to correct it with the time zone, you could add the time zone like this.
'-createdate<${CreationTimeTimestamp}-05:00'
"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