Set System and Outlook Timezones

I travel frequently between timezones and would like to set the system timezone and MS Outlook timezone at once to the same timezone with one trigger. Can this be done with KM?

1 Like

Probably… but without knowing what the steps are for setting the TZ in MS Outlook, it will be hard to say.

It's pretty straightforward within Outlook. It looks like the attached.

For starters, could someone outline the basic steps to automate changing the system timezone? That's a good place to start.

That's pretty easy. I mean, assuming that you don't use the
"Set time zone automatically using correct location"
option in
System Preferences » Date & Time » Time Zone

You can set the time using:

 sudo systemsetup -settimezone 'America/Chicago'

(Use sudo systemsetup -listtimezones to see what time zones it will accept.)

And if you want to automate this, you can add this line to /etc/sudoers:

  %admin ALL=NOPASSWD: /usr/sbin/systemsetup

then you can use sudo systemsetup without having to enter your admin password, which means you can put it in a shell script in Keyboard Maestro.

What time zone am I in right now?

You can also find what the system time zone is set to by using:

  sudo systemsetup -gettimezone

(I have no idea why they require sudo for reading a value but that's another good reason to put it in your sudoers file.)

That's not the only way, however, you can also do

  readlink /etc/localtime | sed 's#.*/zoneinfo/##g'

Or you can use zsh

 #!/bin/zsh -f 

    # ':A' in zsh will get you the full, actual path of any file, 
    # including links showing their real path
 TIMEZONE_FILE=(/etc/localtime(:A))

 echo "$TIMEZONE_FILE" | sed 's#.*/zoneinfo/##g'

Outlook

Now that I think of it, you can probably set the time zone in Outlook using a defaults write command rather than manipulating the GUI… but first we'd have to figure out where Outlook keeps its settings.

It's not in ~/Library/Preferences/ and I checked in ~/Library/Containers/com.microsoft.Outlook/Data/Library/Preferences/com.microsoft.Outlook.plist but did not find a time-zone preference there either. I did some cursory googling but did not find anyone who had answered this… which seems unlikely, I must have just been searching in the wrong places.

This is great. Thank you for taking the time to outline that.

Thanks,

Matt