When I visit some site and it shows me that some action performed at some time – it confuses me a little, because I don’t know in which time zone is this time.
Sure, you can spend some time to read about one’s time zone settings and rules, BUT Don’t make me think. Every website uses his own rules for time setting – some uses GMT zone, some says something like: London or New York or Moscow time.
I, as a potential user, will be much more satisfied if I would see the only one explanation:
All dates and times are in your local time zone settings.
Sounds easy, yet powerful. And on the other hand – hard to implement such flexibility.. But it’s really not.
Recently, I was working on some site, where exact clear time was essential. It was scheduled message sending feature. We had users from many countries in great variety of time zones.
My first idea about how this feature can be implemented – was in involvement of time zones select option, where user can choose his time zone to say to us his local time. But this isn’t very reliable because in one particular GMT time zone many can be located lots of countries with their own time setting rules.
Every single country decides every year when DST transitions will occur. There can be any number of offset transitions during the year: 0, 1, 2, 3, 4 etc. There can be offset transitions that aren’t DST transitions. For example, in 1946 Hawaii changed its standard time offset from -10.5 hours to -10 hours–and this had nothing to do with DST.
So we couldn’t count neither on GMT zone to be sure for 100%, nor for country’s capital GMT offset(Russia, USA, Canada and so on).
The answer was very simple and beautiful.
There is WorldTimeEngine service, which provides a simple API for retrieving user’s local time based on his IP address. It costs not so much, and this information can be cached for quite a long period of time.
I’ve written some simple class, which calculates offset between our server’s time(London, GMT+0) and user’s local time, then it saves this offset to the IP address – Offset dictionary stored in database. So, when we show some time-related information, we implement this offset for every single timestamp – and user always see all info in his local time settings.
Very useful.
Tags: API, worldtimeengine

