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.
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.