PHPBuilder - On User-Defined Timezones in PHP Page 5

RSS Twitter

On User-Defined Timezones in PHP - Page 5

by: David Whittington
September 11, 2003

In Conclusion

It is easy to manipulate date values which are stored as timestamps, and conveniently PHP provides a nice set of functions for converting to and from them. Unfortunately, PHP's functions only understand the server's timezone. It is possible to use PHP's time functions to handle other timezone's, but to do so one needs a clear understanding of exactly what they do. At first this may seem daunting, but with the realization that all PHP's time functions assume that timestamps are in GMT, their interpretation becomes relatively simple. With this knowledge, we created our own solution that provides a consistent way for applications to allow user specified timezones to be applied. Utilizing the fact that the gmmktime function applies no offest in creating timestamps we were able to structure our functions so as to allow specification of an arbitrary offset. Though we did gloss over some important problems such as how to properly determine daylight savings offets we hope that this article will put you on the right path towards developing your own timezone neutral applications.

« Previous Page

Comment and Contribute

Your comment has been submitted and is pending approval.

David Whittington



(Maximum characters: 1200). You have characters left.