Time Zone
Chris Mellon
arkanes at gmail.com
Wed Jan 3 08:03:49 PST 2007
On 1/3/07, Paul Koning <pkoning at equallogic.com> wrote:
> >>>>> "Peter" == Peter Gordon <peter at pg-consultants.com> writes:
>
> Peter> Details are in the manual for "date" and works for Linux
> Peter> Examples: # TZ=NZ date '+%z'
> Peter> +1300
>
> Note that all these examples show the offset as it is in effect at the
> time you ask.
>
> If you want the "base" offset (the one when "summer" time is not in
> effect) this won't work reliably. One way is to pick a time that
> isn't "summer" and feed that to "date" (with -r, which takes an
> arguments in seconds since the Epoch).
>
> You can do this in your program by using "strftime"; that's likely to
> be easier than bringing up the date command in the shell, and should
> be more portable too. Even so, watch out for incompatibilities; in
> Python at least, the %z format marker isn't implemented correctly in
> Windows. (It displays the timezone name instead, verbosely.)
>
> paul
>
>
If you want a more general solution, google for "Olson tables" (thats
what these things are). There's a python module (pyTZ) available, home
page at: http://pytz.sourceforge.net/
More information about the wx-users
mailing list