is there any kind of RFC or tutorial/clarification of these new date/time functions? i'm suffering much confusion from the whole timestamp / gmt / utc / dst stuff.
sad and ongoing event storage confusion and tribulations:
i have a db table that stores events ('events') and and another db table that connects those events to one or more dates and times ('event_time_assoc'). i stored the start and end times for the event as unix timestamps by using mktime(). for instance if the user entered $mm/$dd/$yyyy at time $hh then I would create a start time something like this:
// put this in the db as the start time
$start_time = mktime($hh, 0, 0, $mm, $dd, $yyyy);
what i realize in retrospect (and correct me if i'm wrong about this) but what i am doing in that case is storing the unix timestamp for $mm/$dd/$yyyy at $hh o'clock ON MY SERVER RATHER THAN IN THE LOCALITY OF THE EVENT. In other words, the value that gets stored is not a universal value for that particular date and time but rather, ahem:
the number of seconds since january 1, 1970 in greenwich england when its $mm/$dd/$yyyy at $hh o'clock in los angeles, ca
as you can imagine, this makes it still more confusing when a visitor comes to my site and says "show me all the stuff going on in new york RIGHT NOW" because I have to query my database and um....uhhhh...remember that all those dates and times are perverse bastardizations of the originally entered time which is supposed to be $mm/$dd/$yyyy at $hh in whatever locality they happen to be in (and i have 50,000 zip codes as possible locations with all the TZ offset info [e.g., -8 for california] and DST observance flag as well).
i also was storing the event start and end times as mysql datetime values because i thought i might need to change things at some point.
can anyone recommend how i should
1) store the event start and end times
2) ask the server for the current time to run queries to find events happening RIGHT NOW in any particular zip code?
things to keep in mind:
the queries need to be speedy...so i can't have any queries that force an operation on every start_time field in the database. it needs to be a simple integer comparison or something else that lends itself to indexing
when a user visits the site and enters a zip code for a search, the server needs to somehow determine the current time in that zip code so it can avoid display of events that have passed.
* ideally my code should work for php 4.3+ and also 5+ (and 6+).
any help at all on this matter would be much appreciated.