ExifTool Forum

ExifTool => Newbies => Topic started by: billyg on April 22, 2023, 08:50:23 PM

Title: YYYY MM and DD into csv?
Post by: billyg on April 22, 2023, 08:50:23 PM
Hi there,

I'm exporting data to a CSV file and am having a hard time trying to find a way to get "YYYY" "MM" and "DD" fields. I know i can grab the capture data, but is there a way to get these fields from exiftool into the csv?

This is what i'm currently using:
exiftool -csv -createdate -sourcefile -objectname -description * >2017.csv
Title: Re: YYYY MM and DD into csv?
Post by: Phil Harvey on April 22, 2023, 09:51:57 PM
The problem seems to be that you want separate year, month and day columns for the date.  I can think of a couple of possibilities, but neither is trivial.  It would be simpler to just keep the date together in one field and format it as desired.  For example, to change it to "YYYY-mm-dd":

exiftool -csv -createdate -sourcefile -objectname -description -d %Y-%m-%d * >2017.csv

If you really need to split the date into 3 separate columns, the cleanest method may be to create 3 separate user-defined Composite tags which each reformat CreateDate as required.  An alternative would be to use the -p option to manually format the CSV yourself and use the advanced formatting feature to trim CreateDate as necessary for the year, month and day columns.

I don't have time right now to go into more detail, but this should at least let you know this is possible and point you in the right direction.

- Phil
Title: Re: YYYY MM and DD into csv?
Post by: StarGeek on April 24, 2023, 11:31:28 AM
There isn't a "SourceFile" tag.  It's something automatically created with the -csv option (https://exiftool.org/exiftool_pod.html#csv-CSVFILE).

It might be just easier to split the date in a spreadsheet.  Example (https://www.extendoffice.com/documents/excel/3267-excel-split-date-into-day-month-year.html)
Title: Re: YYYY MM and DD into csv?
Post by: billyg on April 27, 2023, 11:52:33 AM
Yeah, was thinking maybe this could be done by exiftool. But works just as well for me to do it in Excel. Thanks for your help!