#!/bin/sh

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

# Override this here if you like.
local=`cat /etc/timezone`

a="$*"

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

o="--date=TZ=\"${local}\" ${a}"
# Determine if the specified time makes sense.
date "${o}" >/dev/null 2>&1
if [ "$?" -ne 0 ]; then
    echo "\"${a}\" makes no sense."
    exit 1
fi

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);}'
