Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I get time in another time zone ??

53 views
Skip to first unread message

Dave

unread,
Oct 19, 2008, 5:40:35 PM10/19/08
to
I'm in the UK using British Summer Time (BST). I'd like to get the time
in New York (EDT). I believe there is an option to 'clock' to change the
time zone, but any combination I try gives the wrong result.

This is what I have:


set foobar [clock format [clock seconds]]


Ideally, I'd like to get the time in this format:


Sun Oct 19 17:38:07 EDT (New York time)

I can obviously add '(New York time)'. Any suggestions how I can get the
time in the EDT timezone, and ideally in the format shown.

dave


Kevin Kenny

unread,
Oct 19, 2008, 6:36:51 PM10/19/08
to
Dave wrote:
> I'm in the UK using British Summer Time (BST). I'd like to get the time
> in New York (EDT). I believe there is an option to 'clock' to change the
> time zone, but any combination I try gives the wrong result.

You most likely want something like:

clock format [clock seconds] -format "%x %X %Z" \
-timezone :America/New_York -locale en_US

You'll notice that -locale deals with punctuation differences (and
details like month-first vs. day-of-month-first), while -timezone
deals specifically with time zone.

-locale and -timezone need Tcl 8.5 or later. If you're stuck
on 8.4, you can either play games with $env(TZ) or get the
'newclock' extension.

--
73 de ke9tv/2, Kevin

0 new messages