Takeout JSON
EN

ExifTool: Change Date Taken (Set, Shift, From File Name)

Tested ExifTool commands to change the date taken of photos and videos, shift times, read the date from the file name and set the file date, on Windows and Mac.

To change the date taken with ExifTool, run exiftool -AllDates="2019:07:14 12:05:00" photo.jpg. AllDates sets the three EXIF dates at once: DateTimeOriginal (date taken), CreateDate and ModifyDate. To shift instead of set, use "-AllDates+=0:0:0 2:0:0". To copy the date into the file date that File Explorer and Finder show, use "-FileModifyDate<DateTimeOriginal". Every command below was tested with ExifTool 13.59.

Before you start

  1. Install ExifTool: on Windows, unzip it from exiftool.org and rename exiftool(-k).exe to exiftool.exe; on a Mac, brew install exiftool.
  2. Work on a copy. ExifTool changes files in place.
  3. Without -overwrite_original, ExifTool keeps a backup of each file as photo.jpg_original. Keep that while you learn, add the option once you trust the command.
  4. Dates are always written as YYYY:MM:DD HH:MM:SS, with colons in the date too.

The quoting below works in Command Prompt, the Mac Terminal and Linux. In the Mac and Linux examples with $, use single quotes; in Command Prompt, double quotes.

See the current dates

exiftool -time:all -a -G1 -s photo.jpg

This lists every date in the file with its group: [ExifIFD] DateTimeOriginal, [System] FileModifyDate and so on. DateTimeOriginal is what photo apps call date taken.

1. Set an exact date taken

exiftool -AllDates="2019:07:14 12:05:00" -overwrite_original photo.jpg

For a whole folder, give the folder instead of the file. Add -r to include subfolders. Only DateTimeOriginal? Use -DateTimeOriginal="..." instead of -AllDates.

2. Shift dates by hours or days

The camera clock was two and a half hours behind:

exiftool "-AllDates+=0:0:0 2:30:0" -overwrite_original C:\Photos\Trip

The format is years:months:days hours:minutes:seconds. Use -= to go back. One day back is "-AllDates-=0:0:1 0:0:0". In our test, 14:35 on 14 July moved to 14:35 on 13 July.

3. Take the date from the file name

Phones name files like IMG_20190612_153012.jpg. ExifTool can read the date from the name:

exiftool "-AllDates<FileName" -overwrite_original C:\Photos\Screenshots

It finds the digits in order: year, month, day, hour, minute, second. This works for IMG_20190612_153012, Screenshot_2019-06-12-15-30-12 and PXL_20190612_153012345. WhatsApp names like IMG-20190612-WA0007.jpg are the trap: they have no time, and ExifTool reads the 0007 as 00:07. For those, take only the eight date digits and add a time yourself (Mac and Linux quoting shown; in Command Prompt use double quotes):

exiftool '-AllDates<${FileName;s/.*?(\d{8}).*/$1/} 12:00:00' -overwrite_original IMG-20190612-WA0007.jpg

In our test that gave 12 June 2019, 12:00. Check a few results first; a stray number in a name gives a wrong date. See WhatsApp photos with the wrong date.

4. Set the file date from the date taken

File Explorer and Finder sort by the file's own dates, not EXIF. To make them match:

exiftool "-FileModifyDate<DateTimeOriginal" C:\Photos

On Windows, also set Date created:

exiftool "-FileCreateDate<DateTimeOriginal" C:\Photos

FileCreateDate only exists on Windows and Mac. Note that every ExifTool command that writes into a photo resets its file modified date to now. Add -P to keep it, or run the file date command last.

5. Add the time zone

EXIF dates have no zone. Newer cameras write it separately. To record that photos were taken in UTC+2:

exiftool -OffsetTimeOriginal="+02:00" -OffsetTime="+02:00" -OffsetTimeDigitized="+02:00" -P -overwrite_original photo.jpg

Apple Photos and some other apps use it to show the right local time. See photo date off by hours.

6. Videos

MP4 and MOV store dates in QuickTime tags, which by the standard are in UTC. With -api QuickTimeUTC you can write local time with a zone and ExifTool converts it:

exiftool -api QuickTimeUTC "-QuickTime:CreateDate=2019:07:14 12:05:00+02:00" "-QuickTime:ModifyDate=2019:07:14 12:05:00+02:00" -overwrite_original video.mov

In our test this stored 10:05 UTC, and ExifTool reads it back as 12:05+02:00.

7. Only touch photos without a date

exiftool -r -if "not $DateTimeOriginal" -AllDates="2005:01:01 12:00:00" -overwrite_original C:\Photos\Scans

On a Mac, write the condition in single quotes: -if 'not $DateTimeOriginal'. To just list them, replace the date part with -p "$Directory/$FileName".

When the commands become the problem

Changing one date in one folder is quick. Changing dates across years of photos, with several cameras, time zones and file name styles, means a lot of commands and no undo. A GUI that runs ExifTool for you helps there.

On Windows, our Takeout JSON Metadata Fixer uses ExifTool inside. In its Selected Photos tab you choose a library folder, select photos and press Edit: Set Date & Time, Shift Time, Fix Time Zone, Date from File Name and Set File Dates are there as menu items, with a preview of old and new values and undo. The first 100 edits are free; Premium is $19.99 once and also makes Takeout fixing unlimited. ExifTool GUI for Windows compares it with the free ExifToolGUI.

If your photos came from Google Takeout, the right dates are already in the .json files. See ExifTool for Google Takeout instead.