Importing Exif DateTime values - Problem of DataType or other problem?

It is also a #question :wink:

I continue to discover Tropy and, in learning perspectives, I made a Photo Template with all (for testing) available properties of Exif, XMPs and IPTCs vocabularies. I never precised the DataType of the properties so they all were xsd:string.

My major problem was with the different date fields :

Exif property (label) value imported in Tropy value with ExifTool
DateTime 1541182850000 2018:11:02 18:20:50
DateTimeDigitized 1459272621000 2016:03:29 17:30:21
DateTimeOriginal 1459272621000 2016:03:29 17:30:21

So I modified the DataType in my template for these properties before new imports to tropy:date, to dcterms:W3CDTF and to xsd:dateTime and every time the shown values are the same…

I have no more ideas of how I could fix the import to show usable values…

I also cannot read the values imported in ComponentsConfiguration : Values in Tropy always are (but this property is less important for us)

I use Tropy 1.7.0 on Windows 7 pro

1 Like

The tropy:date data-type is the one intended to use for the dates. Currently this will give you localized and formatted display for valid date input; in the future we’re planning to add additional features.

From the examples above I’m assuming the dates in your Exif fields contain dates as Unix timestamps, while Tropy currently expects ISO 8601 strings. I was not aware that Unix timestamps are common, but we can definitely add support for them in Tropy 1.8. The way this would work is that the dates are displayed similarly to the ExifTool examples above, but if you click to edit a date field you would still see the original timestamp (i.e., Tropy will not convert your data, it will just format it nicely for display).

1 Like

Thank you :slight_smile: I found a way to deal with this format until then. Maybe it can help others so :

Conversion with OpenRefine

GREL formula to convert Epoch Time dates imported in exif properties :

"01/01/1970 00:00:00".toDate("dd/MM/YYYY H:m:s").inc(value/1000, "seconds")

(Adaptation of the code found here)