Justtechjobs.com Find a programming school near you






Online Campus Both


On User-Defined Timezones in PHP

ABSTRACT

PHP provides some nice date manipulation functions that work very well in combination with each other. However, they only handle dealing with the server's timezone. Adding the feature for shifting dates to a user-defined timezone can be a very unpleasant experience, as we know first hand. In this article, we discuss the problems we encountered, and present our solution.

Introduction

We work for a software development company, CommNav, who amongst other things has developed a PHP based portal framework and application suite. Until recently it relied solely on PHP's built in date and timestamp manipulation functions for handling date and time values. However, in our most recent release in order to allow our users to specify their own timezones we found it necessary to use our own functions. Doing this turned out to be a bit more complicated than we at first imagined.
By allowing the user to specify a timezone, we unwittingly opened a Pandora's Box, out of which flew shrieking timestamp demons who tormented us, and drove us to the brink of insanity. We decided to write this article to serve as a warning post for travelers of this path. In it, we discuss our implementation prior to the change, our misconceptions about how PHP's time functions work, what PHP's time functions actually do, and our solution to the whole mess.
[ Next Page ]


Comments:
RE: Is ther something wrong with this method?Jason12/01/05 19:23
cofiguring iissujamary09/17/05 13:22
I hate timezones....Ryan02/27/05 05:36
Suneel Kanuri method beats all!Marius Ooms07/30/04 13:24
RE: A better way to go..Olav Alexander Mjelde07/07/04 05:30
A better way to go..Olav Alexander Mjelde04/09/04 15:30
RE: Well DoneOlav Alexander Mjelde03/18/04 17:58
Correction - I think GMT time storage is ok!Peter Matuchniak02/10/04 00:13
RE: Here is something i did with my timezones Vinutha02/07/04 04:33
Good ArticleRoger Rain01/11/04 06:56
Here is something i did with my timezones Suneel Kanuri11/25/03 10:53
TimeZone definition in EnvironmentNikola Savic10/07/03 05:53
It's much easier if you're on *nix...Jonathan09/22/03 16:42
Sometimes it's easier to store both...Peter Matuchniak, B.Sc (Maths)09/12/03 17:32
Well DonePaul09/12/03 10:51
 

If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.