lunes, 22 de febrero de 2010

Time Zone Calculator

As I plan for calls, meetings, or paper deadlines, I often find that I need to check and compare dates and times in different time zones.

When I had to do this, I would look up entries into websites or use some of the many time zone converters out there, clicking and scrolling to select time zones from large lists of cities. After a while, I got tired of this clicking around and I wished there was a way to just type my query into a search box, hit enter and get the result. You can, for example, google “time London” to figure out the current time in many cities around the world but, e.g. for planning meetings in the future, I needed more than that.

So eventually I sat down and hacked out my own Time Zone Calculator to do just that. Appart from boring queries such as “now”, you can also type “10:00pm from Berlin to Mexico”, or even more crazy things like “tomorrow noon from local to Seoul”. To set up your own local time write in the search box something like “here is Mexico”. All the input is typed into a single search box, making it convenient to save it as a quick search in Firefox or Chrome.

The geek bits: Parsing of the input is done with Perl's Date::Manip which allows the search box to understand many different ‘natural’ ways to input dates and times. Time zone conversion itself is done with the DateTime modules that take into account of all the tricky details such as daylight saving times and the like. To extend the amount of cities available, names of cities are geolocated using the Yahoo! Geolocation API, and then time zones obtained from GeoNames.

Feel free to leave feedback and report problems or errors in the comments section bellow.

4 comentarios:

Anónimo dijo...

Its a clever app. but come on, regardiing the kind of problems you solved in ACM, its a piece of cake :)... regards Ferosorno

Juan dijo...

Jeje, si, eso es muy cierto. Tiene rato que ya no hago problemas de ACM y la verdad que si se extraña. Pero bueno, lo encuentro también esto útil y divertido.

Saludos!

alvarezp dijo...

Tienes documentación de las palabras clave? Según los ejemplos que tienes en la página, la frase

July 7, 2010 10:00 EDT to Tijuana

Me debería dar la hora en PDT (Tijuana) de esa fecha originalmente en Eastern Daylight Time.

Sin embargo, en America/New York me está mandando 07:00:00 UTC -4 (EDT*) cuando yo esperaría 10:00:00 UTC -4 (EDT*)

Juan dijo...

alvarezp, la respuesta corta es que actualmente tengo sólo soporte muy limitado de las palabras clave. Si algún día tengo tiempo voy a mirar que está pasando con el ejemplo que me dices y tratar de verificar que las claves se zonas horarias también funcionen.

Sin embargo la forma de hacer que funcionen sin problemas es usando nombres de ciudades en lugar de nombres de husos horarios. Eso es mucho mejor pues evita problemas de ambigüedad (varios husos horarios con la misma clave, y claves con/sin horario de verano).

Gracias de cualquier modo por el comentario y muchos saludos!