ExifTool Forum

ExifTool => Newbies => Topic started by: Athelstan on November 08, 2023, 10:37:39 AM

Title: Setting "Year" tag from "CreateDate" tag but maintaining Year's YYYY format?
Post by: Athelstan on November 08, 2023, 10:37:39 AM
On a collection of my mp4 videos, I want to yet the currently empty "Year" tag to the year they were taken. I want the "Year" tag to be in the YYYY format (e.g. 2014) and not include any other time info (month, day, hours etc.).

I tried the following command

exiftool -year<CreateDate C:\sample.mp4

but this gives me a "Year" tag value of "2014:04:03: 15:21::08", when I want just "2014"

Is there a way to extract the just year from the CreateDate tag and input it into "Year" field?

I have searched the forums and the internet in general but failed to find one.
Title: Re: Setting "Year" tag from "CreateDate" tag but maintaining Year's YYYY format?
Post by: StarGeek on November 08, 2023, 12:48:52 PM
Use the -d (-dateFormat) option (https://exiftool.org/exiftool_pod.html#d-FMT--dateFormat).

exiftool -d %Y "-year<CreateDate" C:\sample.mp4


See Common Date Format Codes (https://exiftool.org/filename.html#codes) for the % variables you can use.

Edit: Forgot the quotes in the tag copy part of the command.
Title: Re: Setting "Year" tag from "CreateDate" tag but maintaining Year's YYYY format?
Post by: Athelstan on November 09, 2023, 06:09:31 AM
Thanks for the quick reply. Much appreciated. :)