I am re-sending this mail as I have not received any replies, surely somebody knows the answer. As I work in Australia I would like to add support for our timezones to the DateTime/DateTimeZone files. Adding the data to DateTime.py is fine but can anyone describe the format of the data in DateTimeZone.py as it somewhat cryptic to say the least ? TIA Robert Leftwich
At 01:33 24/04/99 , Robert Leftwich wrote:
I am re-sending this mail as I have not received any replies, surely somebody knows the answer.
As I work in Australia I would like to add support for our timezones to the DateTime/DateTimeZone files. Adding the data to DateTime.py is fine but can anyone describe the format of the data in DateTimeZone.py as it somewhat cryptic to say the least ?
TIA Robert Leftwich
The DateTimeZone.py file lookes like a stringified database, probably not intended for manual editing. You can however edit the _zmap and _zlist variables in DateTime.py. The trick is that most timezones are whole hour offsets to GMT, and the DateTimeZone database does support these timezones. You'll only have to tell DateTime.py exactly what offset your abbreviation entails. The variable _zmap does just that, it provides a mapping between a (lowercase) timezone name, and a DateTimeZone database entry. _zlist lists all recognized timezones, in proper capitalisation. So, to add WAST, WADT, EAST and EADT zones to DateTime, add the following to the _zmap variable: 'wadt':'GMT+8', 'eadt':'GMT+11', 'wast':'GMT+7', 'east':'GMT+10', and the following to _zlist: 'WADT','WAST','EADT','EAST', then at least those timezones are recognized. I do not (yet) know how to add timezones that are not whole hour offsets to GMT. I thing these will have to be added to DateTimeZone.py (by DC....) I have submitted a patch to the latest CVS version of DateTime to the Collector, which adds a whole list of well know timezones to DateTime, all whole hour offsets. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-6254545 Fax: +31-35-6254555 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
At 01:33 24-4-99 , Robert Leftwich wrote:
I am re-sending this mail as I have not received any replies, surely somebody knows the answer.
As I work in Australia I would like to add support for our timezones to the DateTime/DateTimeZone files. Adding the data to DateTime.py is fine but can anyone describe the format of the data in DateTimeZone.py as it somewhat cryptic to say the least ?
I just saw my patch (adding 33 whole-hour-offset timezones to DateTime) checked into the CVS by Brian LLoyd. If you want these additions, you could use CVS to get a copy of this version of DateTime. First, make sure you can login into the CVS, see http://www.zope.org/Community/CVS_public_access. Do so. Now that you are logged in, go to the lib/python directory of your Zope installation, and execute the following commands: mv DateTime/DateTime.py DateTime/DateTime.py.bak cvs -z9 export -r HEAD -d DateTime Packages/DateTime/DateTime.py and restart your Zope. The export command will get you the latest copy of the DateTime.py file, which is the only file in the DateTime package that has had any (code) changes to it. The timezone abbreviations added are: UT, BST, CDT, MEST, SST, FST, WADT, EADT, NZDT, WET, WAT, AT, AST, NT, IDLW, CET, MET, MEWT, SWT, FWT, EET, BT, ZP4, ZP5, ZP6, WAST, CCT, JST, EAST, GST, NZT, NZST and IDLE Some of these timezone abbreviations have more than one meaning, like BST, which can stand for British Saving Time, or Brazilian Standard Time.... In this case, the first timezone is presented. I did not make that decision, I borrowed this list from (among other places), a Perl Timezone library (Time::Zone). Yes, Perl does have it's advantages. YMMV -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-6254545 Fax: +31-35-6254555 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
participants (2)
-
Martijn Pieters -
Robert Leftwich