View Single Post
Posts: 10 | Thanked: 5 times | Joined on Jan 2010 @ Tasmania, Australia
#117
I love this widget more than life itself. Truly madly deeply. My contribution to the widget is displaying the time in a given timezone:

Code:
export TZ="Europe/London" date "+%H:%M"
Of course, I have a slightly more complex version of that in a worldtime script:

Code:
#!/bin/sh
if [ $# -gt 1 ]
then DATEFORMAT="$2"
else DATEFORMAT="%H:%M"
fi

if [ $# -gt 2 ]
then TIMETOSHOW="-d \"$3\""
else TIMETOSHOW=""
fi

export TZ=$1
date "+$DATEFORMAT" $TIMETOSHOW
and then my widget command is:

Code:
echo "London: " `/usr/bin/worldtime Europe/London` " | Denver: " `/usr/bin/worldtime America/Denver`
I'd also suggest using

Code:
date +<formatcode>
is a preferable way of showing the date, rather than the date | awk script I saw earlier in this thread.

Also, word to the wise: avoid giving your widget a blank title. I did this as a don't-display-title hack. It worked, until I did two of them. Might be time to start again .

Did I mention I love this widget?
 

The Following 2 Users Say Thank You to mjec For This Useful Post: