Jump to content

Multiple time zone calculator workflow


Recommended Posts

What?

Synopsis: If you are regularly attending meetings where people from different countries need to join and you need a quick and easy way to check a future date in all the time zones, wouldn't you love just saying

 

"April 17 10am london to paris,germany,india"

 

And boom. You would know what date and time April 17 10am is in paris, germany and india? Every timezone calculator I've used so far either have clunky drop down menus or, like google time search, only works with current dates, not future dates. Not very helpful.

 

Read on. This workflow does just that. Features:

1) enter your own shortcuts for long timezones (there is a convenience code mapping in a file you can extend)

2) enter full timezones

3) enter cities,countries not part of above and it will use Google to convert it to a timezone (best guess)

4) allows you to enter many destinations at once (tzc 10am md to paris,london,czech,algeria)

 

Download

Download link

Current version of workflow 1.4 

 

Changelog

  • May 5 2013: Released v1.4 - fixed bugs. Removed dependency on DateTime - easier to install for non dev. users. No xcode etc. needed. The workflow should work without any additional installation steps (or so I hope)
  • May 4 2013: Released v1.3 -added Google api integration, added explicit instructions on install pre-requisites
  • April 18 2013: Original version

 

Keyword

tzc

 

How

This is an easy to use time zone converter with multiple tz support. 

Specifically, I often have 'meeting scheduling requirements' with customers from all around the world. So someone asks me 'hey are you ok with a meeting on April 17th at 10am london time?' and then given that I want to make sure that time is ok with me as well as my team members who are in different countries, I need to quickly calculate what that means in different timezones.

 

tzc to the rescue

 

Most available calculators are cumbersome, or, don't handle multiple zones, etc. so I wrote my own

All you need to do for the above is, in alfred type

 

"tzc April 17 10am london to paris,germany,india" and boom - you will have what this means to folks in paris, germany and india.

 

Alternately, you can just say 

"tzc 10am london to paris, germany, india" to skip date. Many other options - see help file in the worflow

 

Here you are converting 10AM maryland to paris and bogotia. Note the different icon for Bogota.

This means, bogota was not recognized and it did a google API matching to resolve the timezone

 

150005555.jpg

 

Here is an example of a future date + time conversion

150005556.jpg

 

 

Note that this workflow requires some perl modules to be installed, so if it does not find them, it will tell you. See below for installation instructions

Also, in that workflow folder, there is a file called mycities.inc - you can assign shortnames to timezones so you don't have to remember long timezone names (london,paris,germany examples are all shortnames defined in mycities.inc - extend it to add your own).  

 

To edit the shortnames "tzc edit"

To get help, "tzc help"

 

150005554.jpg

 

 

Troubleshooting (if things don't work)

This workflow needs two perl modules to be installed. They are

Date::Parse & LWP::UserAgent. You *should* already have them installed but if the workflow is telling you one of these modules are missing, read on:

 

Step 1: Launch a terminal

 

Step 2: Check if you have both Date::Parse and LWP::UserAgent installed

In the terminal, type

perl -MDate::Parse -e 1

 

and then

perl -MLWP::UserAgent -e 1

 

If either of them generate an error, you need to follow the next steps. If neither of the above produce any output, you have them installed already. Enjoy the workflow - you don't need to follow the rest of the steps.

 

 

Step 3:  Type in

sudo perl -MCPAN -e shell

 

It may ask you lots of questions, just go with defaults/yes. Get to a point where you get a cpan> prompt

Then type, one by one

install Date::Parse

install LWP::UserAgent

 

 

 

To make sure, exit cpan, launch a terminal and  repeat step 2 to make sure these don't print any errors.

 

If none of these result in an error, you are all set.

 

 

Comments, feedback welcome. Its possible I am not leveraging some cool things in Alfred - feel free to point them out to me as well.

Edited by arjunrc
Link to comment

Hey great idea and one I could use. I'm having trouble installing the modules. I didn't see a readme but did find some documentation in the info.plist file. I tried to install Text::Capitalize but I keep getting funky errors

Bad luck... Still failed!

Can't access URL ftp://mirror.fraunhofer.de/CPAN/authors/01mailrc.txt.gz.

Could not fetch authors/01mailrc.txt.gz

 

So if I can figure that out are the other modules installed in the same way?

sudo cpan install DateTime

sudo cpan install Date::Parse

sudo cpan install DateTime::TimeZone

Link to comment

Can you launch a terminal and let me know which one of these commands print an error and which ones don't print out anything?

 

Thanks for helping!

 

Looks like the last one generated an error

 

 

Last login: Thu Apr 18 23:21:28 on ttys000
rocco-macbook:~ rocco$ perl -MDateTime -e 1
rocco-macbook:~ rocco$ perl -MDate::Parse -e 1
rocco-macbook:~ rocco$ perl -MDateTime::TimeZone -e 1
rocco-macbook:~ rocco$ perl -MText::Capitalize -e 1
Can't locate Text/Capitalize.pm in @INC (@INC contains: /sw/lib/perl5 /sw/lib/perl5/darwin /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.4 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .).
BEGIN failed--compilation aborted.
rocco-macbook:~ rocco$ 
Link to comment

Yup I Thought so. Actually, that module is not mandatory - I got lazy when creating this and used that function for its convenience. I uploaded a new version that does not use it.

Please try it (Modified link in first post). Thanks for reporting this - I've got so many extras in perl installed, including different perl versions, its hard to tell what will/not work in other machines. On another note, if for any reason this workflow does not work for you and you still need this functionality, try the one hosted on my blog here - I've been using it for ages and it works well.

Edited by arjunrc
Link to comment

Yup I Thought so. Actually, that module is not mandatory - I got lazy when creating this and used that function for its convenience. I uploaded a new version that does not use it.

Please try it (Modified link in first post). Thanks for reporting this - I've got so many extras in perl installed, including different perl versions, its hard to tell what will/not work in other machines. On another note, if for any reason this workflow does not work for you and you still need this functionality, try the one hosted on my blog here - I've been using it for ages and it works well.

Works great! Adding my own cities now! Thanks!

Link to comment

excellent!

Hi Roccitman, would you mind letting me know which version of OSX and perl you have and also if you have XCode installed? Another person is trying to install DateTime and its not working for him, so I wanted to see what you have.

Link to comment

Hi Roccitman, would you mind letting me know which version of OSX and perl you have and also if you have XCode installed? Another person is trying to install DateTime and its not working for him, so I wanted to see what you have.

No problem:

OS is 10.8.3

Perl 5.12.4

Xcode *is* installed.

Link to comment
  • 2 weeks later...

I just released 1.3. It integrates with google apis also to allow you to enter arbitrary city/country names not in your convenience mapps 

I also added instructions on installation - its involved, unfortunately and if you are using Lion you may need to tinker to get things working if you don't have the tools already installed. See first post for download and instructions

Link to comment
  • 1 year later...

Hi :) first of all your workflow is great! very useful. i hate the stupid drop down lists too > <

 

for some reason your workflow does not recognise very common time zones.

I use your WF for international events which are always posted like this

Sunday 9:00pm PST or 6:30pm BST

 

I don't think your WF takes those into account? either that or i couldn't get it to work. thoughts? thanks!

Link to comment
  • 3 months later...
  • 4 months later...

Hi :) first of all your workflow is great! very useful. i hate the stupid drop down lists too > <

 

for some reason your workflow does not recognise very common time zones.

I use your WF for international events which are always posted like this

Sunday 9:00pm PST or 6:30pm BST

 

I don't think your WF takes those into account? either that or i couldn't get it to work. thoughts? thanks!

 

Hi, I'd recommend you use regular names like London,England or California etc. It does get confused if you use short codes. When I was creating this I realized there is short code and expanded short code which is really the right one to use - so I just tested it for regular names and what I did was I integrated it with Google's time zone translation service to convert regular names to recognizable ones

 

Another very useful command is 

tzc edit

That brings up a list of convenience shortcuts you can edit. As you see in that file common short codes like PST, EST etc actually are ambiguous shortcodes and need to be converted to correct ones --> you will see mappings I've added by default. You can edit them.

 

The way "tzc" works is it tries to resolve on its own and if it can't, it queries google's time zone APIs, so you get quite a bit of flexiblity

 

(Sorry for the very very late response - I did not turn on notifications)

Edited by arjunrc
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...