Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

AppleScript to change Time Zones in iPhoto Apps
I had forgotten to set my camera back one hour for the change from Daylight Savings Time in Autumn. I'm a stickler for this, especially when I take some photos on one camera, and some from my iPhone (on which the time is correct). For one thing, this causes iPhoto to arrange the photos in the wrong order, as their timestamps are incorrect.

iPhoto has a 'Batch Change' feature which changes the time/dates on a set of photos. But is not what I wanted, as that just allows me to specify a time, and then increment subsequent photos by seconds/hours/days.

This script sets the photo time to one hour earlier than the photo's current time. It works even across days (i.e. 1st April 2010 00:30H becomes 31st March 2010 23:30H). It does not modify the file creation date, but that could be scriptable as well.

The script could also be used to adjust times forward/backward after travels through different timezones when the camera being used was not set to the local time. Just change the setting of wantedDate to use the offset you need, instead of subtracting 3600 seconds (one hour) as it does now.

Copy and paste the script into AppleScript Editor, and save it with the name of your choice (I called mine 'DST_fix'). If you want it to appear in your Scripts menu put it in the folder ~/Library/Scripts/Applications/iPhoto. You may need to create the iPhoto subfolder first.
tell application "iPhoto"
  set selPhotos to selection -- create a list out of photos that are selected
  repeat with eachPhoto in my selPhotos -- tell each photo to do something
    tell eachPhoto
      set oldDate to date -- get the date and time of each photo
      set wantedDate to oldDate - (60 * 60) -- remove 3600 seconds from the time
      set date to wantedDate -- set new date to each photo
    end tell
  end repeat
end tell
I have only used this script when iPhoto is in viewing mode (not edit mode). It works when multiple photos are selected, even in Smart Folders.

[crarko adds: I tested this, and it works as described.]
  • Currently 2.44 / 5
  You rated: 5 / 5 (9 votes cast)

AppleScript to change Time Zones in iPhoto | 7 comments | Create New Account
Click here to return to the 'AppleScript to change Time Zones in iPhoto' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
AppleScript to change Time Zones in iPhoto
Authored by: Dephex Twin on Jun 04, '10 08:01:16AM

Am I reading this wrong, or isn't this doing exactly what the "Adjust Date and Time..." function in iPhoto does already? And iPhoto provides a checkbox for modifying the original files as well...

"Knicks suck, Yankees suck, Mets suck..."
"...Krypton sucks"

[ Reply to This | # ]
AppleScript to change Time Zones in iPhoto
Authored by: tommybarbour on Jun 04, '10 09:18:17AM

yep, looks like it, except the apple solution allows you to adjust the time by whatever interval rather than just setting one photo to the right time and letting the rest adjust. this is also really useful when you have two cameras and found out their clocks were off by 7 minutes or something. oh, and use smart albums based on the filename to find all photos by that camera...

[ Reply to This | # ]
AppleScript to change Time Zones in iPhoto
Authored by: Old Toad on Jun 04, '10 11:51:45AM

Dephex Twin is correct in that the Adjust Date and Time option will make incremental date or time adjustments to all photos selected even if they are all from different days, months or years. If the first picture is adjusted by 1 month, 2 days, 3 hours and 4 seconds all of the photos will be adjusted by the same amount. Look just above the Cancel/Adjust buttons for the notification. So adjusting for camera time zone or daylight savings errors can be done all within iPhoto.

[ Reply to This | # ]
AppleScript to change Time Zones in iPhoto
Authored by: MtnBiker on Jun 04, '10 12:38:12PM

I find it easier to keep all our cameras on GMT. That doesn't take away from the usefulness of this script, but you'll need it less frequently.

Hermosa Beach, CA USA

[ Reply to This | # ]
AppleScript to change Time Zones in iPhoto
Authored by: Anonymous on Jun 04, '10 01:05:06PM

We have a winner. All hardware clocks should only ever be synchronized to UTC. There is no good reason to keep flipping them around based on your current location's authorities' perception of time: that's a software task.

[ Reply to This | # ]
AppleScript to change Time Zones in iPhoto
Authored by: j-beda on Jun 04, '10 01:24:25PM

Does iPhoto have any ability to interpret GMT info so that it displays local time for the photos? If not, then while going with GMT will solve the "I forgot to change the clock" problem, it will not solve the "I just imported a bunch of photos from someone else" or the "Why does iPhoto think that some of the wedding photos are on a different day?" problems.

[ Reply to This | # ]
Date/Time munging
Authored by: karog on Jun 04, '10 01:31:52PM
For date/time munging, AppleScript lets you do things like:
5 * minutes
2 * hours
3 * days
10 * weeks
where the units provide the correct number of seconds. Makes the code a bit clearer than 60 * 60

[ Reply to This | # ]