# Correct timestamps after the fact [duplicate]

My wife and I took some photos at an event, which we would like to merge into a single set arranged in order of capture time. We thought this would be easy, just rename them in sequence ordered by capture time. Unfortunately our cameras disagree on the current time, so the timestamps are offset from each other by a known (and constant) ammount.

Does anyone have a good way of merging these into a single series? There are several hundred shots from each camera so it will need to be done automatically.

My main machine runs Linux but I have Windows available as well so solutions on either OS are helpful

• Rather than limiting the question/answer to exactly and only a one hour offset, could we expand the question to include other time amounts? Such as a number of days, minutes, or seconds (or a combination of hours-minutes-seconds) such as 1hr:2min:27sec? – Michael C Jan 26 '18 at 3:27
• good idea, I'll change the wording to only specify that the time offset is known and constant – Joseph Rogers Jan 26 '18 at 9:16
• Pretty much all of the answers in the suggested duplicate (and the solutions they offer mostly work only with JPEG files) only address JPEGS and ignore doing the same thing for raw files. – Michael C Jul 29 at 3:56
• @MichaelC the dupe question isn't specifically about raw files, so answers pertaining to raws could go there. And there's nothing about this question being about raw, so I guess I don't see where this question is different from the dupe. What am I missing? – scottbb Jul 29 at 18:35
• @scottbb The answer here is the only one I (who is in no way a command line nerd) found usable for successfully shifting the time stamps in the EXIF info of raw files. That and the fact that it got more upvotes than 7 of 13 of the answers at the other, older, question - even though there appears to have been much more activity in general on the site in 2011 when it was relatively new than in 2018. – Michael C Jul 30 at 8:10

ExifTool is my go-to tool for time-shifting photos.

Assuming Windows, to add 1 hour to all date/time fields stored in the photo metadata:

exiftool.exe -AllDates+=1 C:\path\to\folder\of\photos


or to subtract one hour:

exiftool.exe -AllDates-=1 C:\path\to\folder\of\photos


By default, this will make a copy of the original as backup before modification. To do the modification in place, use the flag -overwrite_original_in_place:

exiftool.exe -AllDates-=1 -overwrite_original_in_place C:\path\to\folder\of\photos


You can use exiftool to move and rename files based on date/time. To organize photos into nested folders "Year/Month/Day/" with each photo named "image_HourMinuteSecond.[ext]" where the file will maintain its original extension (i.e., JPGs will stay JPGs, DNGs will stay DNGs):

exiftool.exe -d C:/path/to/put/organized/photos/%Y/%m/%d/image_%H%M%S.%%e "-filename<createdate" C:/path/to/folder/of/photos


Note that exiftool doesn't care which direction slashes you use for directories.

For more details about file moving/renaming see this documentation.

ExifTool has options for "dry-running" things, but I often end up zipping up a folder or copying it first before running my commands that rename/move files to make recovery easy just in case it doesn't do quite what I intended.

Some of these examples are my own, while some come directly from the exiftool documentation reproduced here for convenience.

Fine-grained date/time adjustment. This is the long form to subtract 1 hour, for which the above is a shortcut:

exiftool.exe "-AllDates-=0:0:0 1:0:0" C:\path\to\folder\of\photos


So, To add 5 years, 10 months, 2 days, 10 hours, 48 minutes, and 4 seconds:

exiftool.exe "-AllDates+=5:10:2 10:48:4" C:\path\to\folder\of\photos


Filter by date/time before adjusting. I use this to fix a missed DST adjustment within a large group of pictures, it filters out anything before the time-shift:

exiftool.exe -if '$createdate gt "2012:03:11"' -AllDates+=1 -overwrite_original_in_place C:\path\to\folder\of\photos  You can run the tool recursively, meaning it will repeatedly go in to all subdirectories of the given path: exiftool.exe -r C:\path\to\folder\of\photos -AllDates+=1  You can filter by file extension if you want to fix DNGs, but not JPGs, for example: exiftool.exe -ext dng -AllDates+=1 C:\path\to\folder\of\photos  You can combine all these. Recursively find all JPGs created after Mar 11, 2012 and add 1 hour to the all dates by modifying the files in place: exiftool.exe -r C:\path\to\folder\of\photos -ext jpg -if '$createdate gt "2012:03:11"' -alldates+=1 -overwrite_original_in_place

• Looks like exactly what I need, thanks! As is customary I'll wait a day before accepting an answer but have a +1 in the mean time – Joseph Rogers Jan 26 '18 at 0:23
• To make this answer more usable to more people, would it also be possible to add an example of a command to advance the time by days, minutes, or seconds as well as by hours? – Michael C Jan 26 '18 at 3:25
• Note that exiftool can also rename the files based on Exif fields, if you're concerned about the filenames as well (hinted at in the question). – junkyardsparkle Jan 26 '18 at 6:54