I am using Pear::Calendar as the basis for an event system, my question is about dealing with timezones.
I store all the times in the database in GMT using the http://uk.php.net/manual/en/function.gmmktime.php function. This is so that that is the server moves, the user changes their timezone etc or any other factor then we don't have to update times in the database. When a time is acutally used, it is processed by adding/subtracting hours to get into user's timezone (and DST considered as well).
This is where my question about using PEAR:Calendar comes into play.
At the moment, our calendar app is inconsistant, one of the reasons it is being rewritten. It uses mySQL DATE and TIME for storage but I am planning on changing this to timestamps.
But I do not quite understand how this is going to affect putting dates into PEAR::Calendar. What is PEAR::Calendar's timezone based on? I think it is based on mktime(), which is the server time which is thus a big problem. Would a recommended solution be to change all the calls to mktime() to gmtime() and then before passing an event to the calendar, i do our normal timestamp adjustment? Then that event would appear on the calendar in the correct place, according to that user's timestamp?
Thank you for any suggestions/help regarding this.




Bookmarks