Web Design Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignWeb Design Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 9th, 2011, 11:02 PM
ntomsheck ntomsheck is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2010
Posts: 162 ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 12 h 6 m 17 sec
Reputation Power: 61
How do YOU handle time zones and DST on your website?

'Evening gents and gals,
I was wondering what creative solutions some have come up with for handling time zones and DST internationally? I have a couple ideas, but all have their pitfalls:

Option 1:
Have user select a unix style timezone (America/Chicago, America/Anchorage etc)
Benefits: if servers are kept up to date, this should keep track of whatever DST and timezone standard is current
Pitfall: Huge list of time zones for users to scroll through

Option 2:
Have user select standard time zone name (Mountain, Eastern) and check an "Honor DST Rules" checkbox
Benefit:Only ~28 time zones to scroll through
Pitfall:Have to keep an up to date list of when/if DST applies for each region, and run a check/calculation for each user or each page render

Option 3:
Fire an ajax request off to a page that updates the offset (obtained from the browser) every time a user logs in.
Benefit:Modern browsers should follow whatever the system time is set to, and thus should be (for the most part) current.
Pitfall: Complete reliance on javascript is silly, and an extra request/database query

Obviously, there are a few others out there, such as combining 1 and 2

My best example for something that does this extremely well:
Facebook.
That website only announces a users birthday when it's that users birthday in that users time zone (AFAIK) - you never see birthday wishes at 10pm or 9pm the previous day. Yet, I don't remember ever entering a time zone, which makes me think it uses the third option I listed.

Reply With Quote
  #2  
Old November 9th, 2011, 11:54 PM
E-Oreo's Avatar
E-Oreo E-Oreo is offline
Lost in code
Click here for more information.
 
Join Date: Dec 2004
Posts: 7,931 E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 2 Months 7 h 49 m 26 sec
Reputation Power: 7053
You might try #3 on top of #2 or #1, but I wouldn't do it exclusively. A user may intentionally have their clock set incorrectly, so you should give them a way to work around that (or maybe they're traveling and the time changes automatically on their phone but they don't want it to change on your website).

#1 is probably your best list. Most people know what major cities they live near. A significant number of people have no idea what time zone they live in or whether or not daylight savings time is active.

Even if you haven't told Facebook where you live I can almost guarantee you that they have a pretty good idea already.
__________________
PHP FAQ
How to program a basic, secure login system using PHP

Quote:
Originally Posted by Spad
Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

Reply With Quote
  #3  
Old November 10th, 2011, 02:23 AM
ntomsheck ntomsheck is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2010
Posts: 162 ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 12 h 6 m 17 sec
Reputation Power: 61
Yeah I never thought of people not knowing their timezone, but you're right, it's probably a larger amount than most would feel comfortable admitting.

Thanks for the suggestions, I probably will go with option 1 + 3 - just have to think of a good way to break it down. Perhaps a country selector? Maybe I could have that automagically populate based on IP.

Dunno how I'd combat time zone updates with method 3 in the situation you suggested. Perhaps turn them off if a mobile browser is detected?

I'll brainstorm a bit haha. Thanks

Reply With Quote
  #4  
Old November 10th, 2011, 10:48 AM
Kravvitz's Avatar
Kravvitz Kravvitz is offline
CSS & JS/DOM Adept
Dev Shed God 30th Plane (19500 - 19999 posts)
 
Join Date: Jul 2004
Location: USA
Posts: 19,833 Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level) 
Time spent in forums: 6 Months 1 Day 20 h 52 m 20 sec
Reputation Power: 4192
I use option2 with this list of timezones. Users that haven't selected a timezone will see times in the default that I set.
Code:
$timezones = array(
  '-0100' => '(GMT -1:00 hour) Azores, Cape Verde Islands',
  '-0200' => '(GMT -2:00) Mid-Atlantic',
  '-0300' => '(GMT -3:00) Brazil, Buenos Aires, Georgetown',
  '-0330' => '(GMT -3:30) Newfoundland',
  '-0400' => '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz',
  '-0500' => '(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima',
  '-0600' => '(GMT -6:00) Central Time (US & Canada), Mexico City',
  '-0700' => '(GMT -7:00) Mountain Time (US & Canada)',
  '-0800' => '(GMT -8:00) Pacific Time (US & Canada)',
  '-0900' => '(GMT -9:00) Alaska',
  '-1000' => '(GMT -10:00) Hawaii',
  '-1100' => '(GMT -11:00) Midway Island, Samoa',
  '-1200' => '(GMT -12:00) Eniwetok, Kwajalein',
  '+0000' => '(GMT) Western Europe Time, London, Lisbon, Casablanca',
  '+0100' => '(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris',
  '+0200' => '(GMT +2:00) Kaliningrad, South Africa',
  '+0300' => '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg',
  '+0330' => '(GMT +3:30) Tehran',
  '+0400' => '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi',
  '+0430' => '(GMT +4:30) Kabul',
  '+0500' => '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent',
  '+0530' => '(GMT +5:30) Bombay, Calcutta, Madras, New Delhi, Colombo',
  '+0600' => '(GMT +6:00) Almaty, Dhaka, Bangladesh',
  '+0700' => '(GMT +7:00) Bangkok, Hanoi, Jakarta',
  '+0800' => '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong',
  '+0900' => '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk',
  '+0930' => '(GMT +9:30) Adelaide, Darwin',
  '+1000' => '(GMT +10:00) Eastern Australia, Guam, Vladivostok',
  '+1100' => '(GMT +11:00) Magadan, Solomon Islands, New Caledonia',
  '+1200' => '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka'
);

Quote:
Have to keep an up to date list of when/if DST applies for each region

I don't do that though. I rely on the server to know if DST is active or not.
Quote:
run a check/calculation for each user or each page render

Don't you have to do that anyway for any of the ways to allow users to see times in their own timezone?

Quote:
Huge list of time zones for users to scroll through

Yeah. Displaying that large list as a single level would be a mistake, but if there was a good way for users to filter through it, then it might be best.
__________________
Spreading knowledge, one newbie at a time. I'm available for hire at Dynamic Site Solutions.

Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

Remember people spend most of their time on other people's sites (so don't violate web design conventions).

Reply With Quote
  #5  
Old November 10th, 2011, 01:03 PM
ntomsheck ntomsheck is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2010
Posts: 162 ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level)ntomsheck User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 12 h 6 m 17 sec
Reputation Power: 61
Kravvitz, that's very similar to the list I'm using now haha. Infact, I think it's exactly the same - except I use seconds for the offset.

Quote:
I don't do that though. I rely on the server to know if DST is active or not.


How does your server know it's DST for their timezone? Do you pass a guestimated area to it? The issue being that DST begins at different times and different direction depending on which country you live.

I thought about trying to match up a unix style time zone with the offset they provide. IE if they pick GMT -7:00, the server stores it as 'America/North Dakota/Beulah and I can just cue it off with a set_default_timezone() in php. Whereas if they pick -7:00 with no DST, I can set it to 'America/Phoenix'. This will CATO once a city/state changes their DST standards, since I have no interest in following DST standards religiously.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignWeb Design Help > How do YOU handle time zones and DST on your website?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap