Extracting date/time info exactly as-is

Started by MartinB, August 05, 2024, 07:47:01 AM

Previous topic - Next topic

MartinB

I'm trying to extract multiple date/time metadata strings from a bunch of files in order to test how my own code can cope with fields using formats that are not strictly valid.
I read and have tried to follow FAQ 5.
I'm trying to use

exiftool -T -n -filename -XMP:DateTimeOriginal -XMP:CreateDate# -XMP:DateCreated -XMP:GPSTimeStamp -FileCreateDate -exifIFD:CreateDate -exifIFD:DateTimeOriginal -IFD0:ModifyDate -api strictdate=0 000107.jpg > dates.csv

I know this sample file has CreateDate set using the correct XMP format, with a 'T' in the middle: "2005-05-09T16:01:42-05:00", but even with the -n option, and with a '#' at the end of the CreateDate tag, it's being converted to the standard ExifTool export format, with a space in the middle: "2005:05:09 16:01:42-05:00".
I wondered if it might be an interaction with -T, but it's not.
I'm on Windows 11, using ExifTool.exe 12.92
Any ideas what I'm doing wrong?

StarGeek

I believe the only way to retrieve the exact data would be to use the -v (-verbose) option and parse the output from that. Or create your own version of the tag that extracts the raw data without reformatting.
"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

MartinB

Interesting, thanks. Yes, that would work. I hadn't seen the -v option used like that before. I'm processing 309000 JPEG files (from the online file corpus collection), but a quick calculation shows that the output stream should only be around 600MB, so I should (hope!) be able to handle that. I may have to leave my parser running overnight for it, though!


MartinB

Yes, this worked. My code can now consume all date formats that were in the 300000 JPEG files I tested, where I was confident I could parse them correctly.
Having seen some of the crud that developers were putting into date fields, I am now even more impressed by Phil Harvey's stamina, stubbornness and patience in dealing with it!

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