You are here: Re: How to Enumerate and Calculate Timezones? « PHP Programming Language « IT news, forums, messages
Re: How to Enumerate and Calculate Timezones?

Posted by Toby A Inkster on 06/14/07 12:20

David T. Ashley wrote:

> In the /usr/share/zoneinfo directory (I'm assuming that is what you meant),
> there are a bunch of files and directories, but they seem to have binary
> contents, and I don't know the format.

See "man zdump".

Examples:

[ti@ophelia (pts/5) ~]$ /usr/sbin/zdump "UTC"
UTC Thu Jun 14 12:11:43 2007 UTC
[ti@ophelia (pts/5) ~]$ /usr/sbin/zdump "Australia/Yancowinna"
Australia/Yancowinna Thu Jun 14 21:41:47 2007 CST
[ti@ophelia (pts/5) ~]$ /usr/sbin/zdump "Australia/NSW"
Australia/NSW Thu Jun 14 22:11:50 2007 EST

(For those who are interested, the eastern mainland states of Australia,
are divided into counties, though these divisions are rarely used.
Yancowinna is a county in the extreme west of New South Wales, notable for
two facts: it contains Broken Hill, an old opal mining town which was the
filming location for most of "Priscilla, Queen of the Desert"; and it uses
a different timezone from the rest of the state.)

Anyway, zdump is able to tell you the current time in any given timezone.
By comparing that with the time in UTC, you ought to be able to find its
UTC offset programmatically.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 110 days, 19:52.]

URLs in demiblog
http://tobyinkster.co.uk/blog/2007/05/31/demiblog-urls/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация