Manage epoch date format

Started by dariopnc, July 03, 2022, 06:41:54 AM

Previous topic - Next topic

dariopnc

Hello everyone: I have this drone (DJI) that saved pictures and videos without properly setting date/time tags, but appends the shooting date in epoch format (seconds from 1/1/1970) to the filename.

e.g. DJI_export_1656844941.jpg (for Sun, 03 Jul 2022 10:42:21 GMT)

I haven't been able to use that to add the shooting date into the tags. I also searched the website and the forum with no luck.

In case I missed some important info, can you please ponit me to it? Otherwise can this be a new feature?

Thank you for the great job so far, btw!

StarGeek

You have to strip away everything from the filename other than the timestamp numbers and then use the -d (-dateFormat) option with %s as the format (see Common Date Format Codes for full list of codes).

Example:
C:\>exiftool -P -overwrite_original -d %s "-AllDates<${Filename;m/(\d{10})/;$_=$1}" Y:\!temp\ccc\a\DJI_export_1656844941.jpg
    1 image files updated

C:\>exiftool -time:all --system:all -G -a -s Y:\!temp\ccc\a\DJI_export_1656844941.jpg
[EXIF]          ModifyDate                      : 2022:07:03 10:42:21
[EXIF]          DateTimeOriginal                : 2022:07:03 10:42:21
[EXIF]          CreateDate                      : 2022:07:03 10:42:21
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

dariopnc

Thank you!
I'll try with that

Also thank you for pointing me to the relevant documentation