Batch change date and time

I've got a large number of photos that for some reason have lost their correct dates and creation times, so I was wanting to fix them in a nice easy way. Unfortunately I've found out that Photos doesn't have the batch change option that used to be in iPhoto.


When trying to find a solution to my problem I came across this Batch Change the Date and Time to a Fixed Date, which works great, but not quite how I want it to. What I'm wanting to do is exactly what the above script does, but instead of incrementing by 1 minute per photo, I want to increment by 1 second intervals per photo.


Having not really used AppleScript before, I tried changing the references to "minutes" to "seconds" but that didn't work. Is it possible to do the above using seconds instead of minutes?


Any guidance would be greatly appreciated. Thanks.

Posted on May 3, 2016 1:18 PM

Reply
16 replies

May 4, 2016 9:23 AM in response to Satkin

Simply delete the text " * minutes" in the lines where the date is changed.


Then the time will be incremented by seconds.


For example for the first version of the script use:



set timeIncrement to 1 -- the time increment in seconds

(* select at least 2 images in Photos *)

tell application "Photos"


activate

set imageSel to (get selection)

if (imageSel is {}) or (the length of imageSel < 2) then

error "Please select at least two images."

else


set first_image to item 1 of imageSel

set first_date to (the date of first_image) as date

repeat with i from 2 to count of imageSel


set next_image to itemi of imageSel

set next_date to (the date of next_image) as date


set time_difference to (first_date - next_date) + ((i - 1) * timeIncrement)



tell next_image

set the date of next_image to (next_date + time_difference) as date

end tell


end repeat

end if

return "Adjusted the date and time of " & (the length of imageSel) & " photos. The last date is " & ((the date of next_image) as date)

end tell

May 3, 2016 2:16 PM in response to Old Toad

That's because seconds are not displayed in the date created field of the Info pane in Photos.

You could change that, if you want, OT.


When I experimented, I found that Photos is using the date format as set in the the System Preferences > Language & Region Advanced > Times


I set this format to always display the time zone:



User uploaded file


In Photos I am seeing:

User uploaded file

May 4, 2016 12:14 AM in response to Old Toad

I've tried the same setup and still can not get the seconds to display in Photos. They do display in iPhoto, however.

Did you restart both the Finder (Force quit) and Photos after you change the the Date & Time format? It usually requires a restart, but I prefer to force quit the Finder.


Photos is using the "Short" time format in the Info panel - the first line of the time formats in the system preferences.


It is really unfortunate, that the Photos developers have this tendency to hide information or display it only imprecisely. How are they expecting us to deal with burst photos or to get the exact date and location of a photo?

For my scientific photos I am still using the Aperture library, where the locations are displayed as latitude, longitude, altitude and not just as a location name without the altitude, and the capture date is displayed with the correct time zone.

May 17, 2016 7:30 AM in response to léonie

Will your script work to change the date of the picture into the future?

In the Album I created - when I change the date of the first picture to a date that is in the future of the others in the batch the picture moves to the last position of the album.

That causes a problem in using the script to change the batch to a date in the future.

Am I thinking about this right?

May 17, 2016 8:17 AM in response to WJ713

Will your script work to change the date of the picture into the future?

Yes, it does.

when I change the date of the first picture to a date that is in the future of the others in the batch the picture moves to the last position of the album.

Drag the photo back after you changed the date of the first image. That will set the sort order to a manual sort. Only then run the script.

Jun 14, 2016 4:10 PM in response to léonie

HI

I tried your script and it worked after I had figured out how to copy and paste it into the script editor and run it. I haven't used that before!


I also tried selecting multiple photos in Photos and then using the drop down menus of Image and 'adjust time and date'. That worked as well however it is there any way you can make it so that the adjusted dates are all on the same day? It seems to advance forward the dates and the adjusted dates are on different days.


I am using Photos 1.5 and El Capitan 10.11.5


Many thanks in advance

Jun 14, 2016 11:50 PM in response to kwkiwi

I also tried selecting multiple photos in Photos and then using the drop down menus of Image and 'adjust time and date'. That worked as well however it is there any way you can make it so that the adjusted dates are all on the same day? It seems to advance forward the dates and the adjusted dates are on different days.

That is exactly why I wrote the script.


The built-in "Adjust Date&Time" will shift the dates of all photos by a fixed in increament. It is meant to be used, if the date in your camera is wrong and you need to correct it after you imported the photos taken with a wrong camera date. Or if you forget to set the camera to the correct time zone.

But Photos has no tolls to to set the date for several scanned photos like iPhoto could.

Jun 16, 2016 3:27 AM in response to léonie

Just wanted to express again, Leonie, my heartfelt thanks for you posting up that script to batch change the dates on photos in Photos. I am scanning all my late mother's photos, some 70 years worth of photos. Without your script it would not have been possible to do the project as it isn't viable to individually change the dates. Many thanks once again, much appreciated and the script works really well.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Batch change date and time

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.