In general, you can define a time zone as an offset (i.e. -08:00) or by the text name, like MDT etc. There are also longer names, depending on your time zone database on your system, like US/Chicago etc... using the numeric offset, of course, means you'll be handling DST adjustments yourself. Using the named type, generally means the DST change of an hour is handled by the system.
There's some more links on the MySQL page about timezones that points to some data used for it. note that timezone database info is integral to most linux systems, like redhat, and is updated when you do package updates. It's a question of making your db support them.
I really think MySQL 3.xx.yy is getting a bit long in the tooth. Setting a require of 4.0.xx (where xx is the latest patch level) isn't really setting the bar that high, and if you're worried about the GPL'd connect libs, you should be migrating to another database without such issues. Firebird, or postgresql are both good choices, postgresql generally has more developers working on it at a given time, and is my personal preference, but firebird generally is more forgiving to beginning DBAs than PostgreSQL is.
I'd suggest having a page where users can set a time zone from a drop down list if one isn't already set, and having a bool or something like it to show that the timezone has been set. note that the internal setting WILL be in GMT, not the one for the user. I.e. the user enters 12:00:00 US/San Diego, or something like that, and the computer sets it to 18:00:00 or 19:00:00 something like that depending on the daylight savings setting and the base offset. I'm not sure what the actual offset is for San Diego btw, that was just an example.
Then, if Joe in Chicago pulls it out, he'll get 14:00:00 or 15:00:00 or 13:00:00 or whatever based on the offset and his setting for time zone.
1. as i mentioned, i'm allowing users to set their own timezones. on every page request i can simply set the timezone setting but i still don't see how that will affect any of the GMT dates/times when they are pulled out of the db.
Remember, time zone setting affects the displayed, not stored, time. Well, it affects the stored time in terms of absolute setting when you set it the first time, but it's converted to GMT internally (or at least it should be) and converted back to the client's local timezone on retrieval. If you don't want this, then you'll need to make a separate field to store the timezone and use that to set it on each retrieval. you can usually use a cast of some sort to cast and interval multiplication to get the retrieved time to the time zone you want. Another reason to abandon the dodgy MySQL 3, it has no casts, what database has no casts???
2. i still don't see how any of these timezone features in mySQL will solve my problem with the DST adjustment. as i said before, manually shifting all of the dates to a specfic timezone is the easy part. how do i know which dates are in the DST window or not.
Again, are you thinking the timestamps are stored WITH their time zone? In standard SQL they're not. if you want the time zone stored you get to do it, and you get to pump the GMT dates through some kind of GMT to proper timezone conversion on each retrieval.
3. it appears that all of that timezone stuff was added in mySQL 4.1.3 and i was hoping for a lower minimum system requirement with this app so i guess i would still have to do the date math manually anyway.
Your choice. I gave up on MySQL 3 (and even 4 actually) a year or so ago. 5.0.19 is quite stable, and works well enough for this kind of stuff. My mainline development is still in PostgreSQL, but I don't use a 5 or 7 year old version of that either.
i'm begining to think that i will just have to map out the future DST shifts in a table and look it up for each date.
You can probably use the table MySQL supplies for upgrades to 4.0.3 and above in 3.xx.yy and do the maths yourself.
i'm sure i'm not the first person to address this problem so i assume somewhere someone has a CSV or something with all of that data mapped out. even if it is mapped out it seems that it is certainly subject to change. George W Bush signed an energy bill last year that will change the DST shift in the US starting in 2007. i suppose anyone who is still using an old palm pilot or whatever will likely see the wrong date/time for part of next year.
Of course somebody's done it. It's been part and parcel of most linux and other unix distros for some time (barring HPUX and Windows, which are still apparently using the digital equivalent of stone knives and bear skins for time zone manipulation). And Version 4.0.x and up of MySQL support it. And PostgreSQL has for quite some time.
take a look here: [URL=ftp://elsie.nci.nih.gov/pub/]time zone data[/URL] and here: MySQL page on time zone data tables
Note that this will be putting one set of time zone data in the database, and another set in the OS, which might not agree, but you'll likely not be using the one in the OS if you're using 3.xx.yy since it can't access the OS time zones anyway.
Ya know, this is one of those little things that is so frustrating about the continuing use of MySQL 3.23.xx. It's out of date, it's missing many key functionalities. The next three versions of MySQL (4.0, 4.1, 5.0) have been released and bug tested. They are stable. they can do so much more. And yet, in large part because of the tactic of GPLing the connect libs, and also due to the intertia of "if it ain't broke don't fix it" mentality of hosting companies, you get to reinvent the wheel again and again.
The same thing, by the way, happens to a lesser extent to PostgreSQL. The latest version will have some huge improvement in it, and somebody shows up on the list asking why 7.4.xx doesn't do x, y and z. Well, 8.0 or 8.1 do it. upgrade. They can't, they're stuck on 7.4 due to management decisions or their hosting provider.
Good luck on this, hope I've pointed you in the right direction at least. Please keep us informed of how you've handled it and how it worked out, won't you?