Author Topic: Date format  (Read 388 times)

gnespolino

  • Newbie
  • *
  • Posts: 2
Date format
« on: February 15, 2019, 04:00:35 PM »
Hello, first of all thank you to Phil and all devs involved in this wonderful piece of code.
I'm writing a java application to catalog and query images and I'm very interested in extracting meta data using exiftool.
I already looked around and found some projects that already wrapped exiftool and expose a java api to use this tool, but you know developers too many times like to reinvent the wheel.
Basically I'm developing a spring boot application which will act as a daemon, monitoring source folder(s), detect changes and extract/update metadata accordingly into some kind of store. Then  I'll expose rest services to query this database basically in every possible way.
I'm doing this as a hobby, since I tried most photo management software out there and none satisfied me completely. Then will come a web interface to tide everything up.
To make a long story short, I'm developing a new java api to extract metadata using exiftool, using a pool of thread, taking advantage of stay_open, recursive, json format, group tags etc. and trying to apply all best practice I can, so to keep the code clean and the most agnostic as possible, I need to extract data using -n (no print conversion) option (which in as far as I understand should return "raw" data).
Unfortunately I'm observing that dates are returned as ISO strings instead, even if "-d %s" is specified.
Basically with "-d %s" I can have dates as epoch, but other fields are formatted in a human readable way, while when using "-n" all field are machine readable except dates which are still human readable. Using both has same behavior as "-n" alone.
So, does anyone knows how to have all fields machine readable, using epoch for dates ?

Giuseppe
 

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16885
    • ExifTool Home Page
Re: Date format
« Reply #1 on: February 15, 2019, 04:12:05 PM »
Hi Giuseppe,

The "machine-readable" data format that ExifTool uses is equivalent to the EXIF date format.  If you want seconds since the epoch, you can use -d %s, but you can't do this with -n because that would disable the conversion.  If you really need ExifTool to convert to seconds since the epoch with -n for the other tags, you could do this using a complicated -api filter option, but I would think it would be easier to do this on your side in the Java code.

- Phil
« Last Edit: February 15, 2019, 10:19:00 PM by Phil Harvey »
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

gnespolino

  • Newbie
  • *
  • Posts: 2
Re: Date format
« Reply #2 on: February 15, 2019, 05:14:03 PM »
Hey Phil, thank you for your answer!
probably on my side it's better to parse dates than all other tags, so I'll go through that way :)

Great job and thank you. ExifTool is a masterpiece!