David Edmondson
What time is it?

Like many other people, I work with others who are spread around the globe. Figuring out when is a good time to call, what would be a sensible meeting time, etc. is always awkward - especially when the daylight savings rules keep changing.

Here's a small script called wwt that I use to help understand what the time is:

#!/bin/sh

# Which timezones to report
zones="UTC \
Europe/London Europe/Paris \
US/Eastern US/Central US/Mountain US/Pacific \
Asia/Shanghai"

local="${TZ}"
if [ "${TZ}" = "" ]; then
    local=`cat /etc/timezone`
fi

a="$*"

# If no time is specified, use now.
if [ "${a}" = "" ]; then
    a=`date`
fi

# Determine if the specified time makes sense and determine the 'fully
# qualified' version of the specified time, i.e. including the date.
o="--date=TZ=\"${local}\" ${a}"
d=`date "${o}"`
if [ "$?" -ne 0 ]; then
    echo "\"${a}\" makes no sense."
    exit 1
fi

o="--date=TZ=\"${local}\" ${d}"

for i in ${zones}; do
    t=`TZ=${i} date "${o}" +"%l:%M%p" | tr '[A-Z]' '[a-z]'`
    d=`TZ=${i} date "${o}" +"%A %e %B %Y (%Z, %:::z)"`
    s="${i}#${t}#${d}"
    echo ${s}
done | awk -F\# '{printf("%16s: %s  %s\n", $1, $2, $3);}'

I use it in three ways: to find out what time it is now in various places (my local timezone is set to Europe/London, where it's now 11:54pm):

$ wwt
             UTC: 11:54pm  Tuesday 19 January 2010 (UTC, +00)
   Europe/London: 11:54pm  Tuesday 19 January 2010 (GMT, +00)
    Europe/Paris: 12:54am  Wednesday 20 January 2010 (CET, +01)
      US/Eastern:  6:54pm  Tuesday 19 January 2010 (EST, -05)
      US/Central:  5:54pm  Tuesday 19 January 2010 (CST, -06)
     US/Mountain:  4:54pm  Tuesday 19 January 2010 (MST, -07)
      US/Pacific:  3:54pm  Tuesday 19 January 2010 (PST, -08)
   Asia/Shanghai:  7:54am  Wednesday 20 January 2010 (CST, +08)
$ 

To find out what time it would be when it's 8am here:

$ wwt 8am
             UTC:  8:00am  Tuesday 19 January 2010 (UTC, +00)
   Europe/London:  8:00am  Tuesday 19 January 2010 (GMT, +00)
    Europe/Paris:  9:00am  Tuesday 19 January 2010 (CET, +01)
      US/Eastern:  3:00am  Tuesday 19 January 2010 (EST, -05)
      US/Central:  2:00am  Tuesday 19 January 2010 (CST, -06)
     US/Mountain:  1:00am  Tuesday 19 January 2010 (MST, -07)
      US/Pacific: 12:00am  Tuesday 19 January 2010 (PST, -08)
   Asia/Shanghai:  4:00pm  Wednesday 20 January 2010 (CST, +08)
$ 

To find out what time it would be when it's 8am in US/Pacific:

$ TZ=US/Pacific wwt 8am
             UTC:  4:00pm  Tuesday 19 January 2010 (UTC, +00)
   Europe/London:  4:00pm  Tuesday 19 January 2010 (GMT, +00)
    Europe/Paris:  5:00pm  Tuesday 19 January 2010 (CET, +01)
      US/Eastern: 11:00am  Tuesday 19 January 2010 (EST, -05)
      US/Central: 10:00am  Tuesday 19 January 2010 (CST, -06)
     US/Mountain:  9:00am  Tuesday 19 January 2010 (MST, -07)
      US/Pacific:  8:00am  Tuesday 19 January 2010 (PST, -08)
   Asia/Shanghai: 12:00am  Thursday 21 January 2010 (CST, +08)
$ 

It would still be nice if Google Calendar had decent timezone support, of course.

Update: Steve pointed out that the date for Europe/Paris was incorrect in the second two examples. Given that he was right, I fixed the script.