Solved

How can I update the timezone based on US DST ?

Posted on 2015-01-22
6
109 Views
Last Modified: 2015-01-27
I have a website with US timezone maintained in "America/Los Angels" located server.   My server timezone is set as GMT.   I have a table called "time zones" with GMT hour + seconds difference.  

I am calculating the time based user (he will be from US region) timezone with my "time zones" table and display it.  Every user will have it is own timezone to calculate all the time display. I am fine this with my timezone table.

My client says I need to consider "Daylight Savings Time" along with my table and above structure.  How  can I find out the daylight saving time all the time in a year and update the timezone OR calculate as per the above scenario ?

I googled and could not find how to do exactly.  Can anyone help me?
0
Comment
Question by:Loganathan Natarajan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 250 total points
ID: 40564958
The timezone tables take DST into account, you don't need to.  And just putting in an offset won't get DST for you because DST is based on local law and not the offset from GMT.  Arizona for example, does not use DST even though the states around it do.

http://php.net/manual/en/timezones.php
http://php.net/manual/en/function.date-default-timezone-set.php
0
 
LVL 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 250 total points
ID: 40565509
This article tells how to handle Date/Time in PHP.  I believe the article covers these points, as well as issues related to getting the client time from their browser, etc.

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html
0
 
LVL 36

Author Comment

by:Loganathan Natarajan
ID: 40572082
@ Dave Baldwin  The timezone tables take DST into account, you don't need to.

Check the attachment table structure as " timezone tables" ?  Is this OK?

Then How can I know about DST and add the difference hours into the timezone ?  Just clarify.
timezone-1.png
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 250 total points
ID: 40572315
No, that is not likely to work.  Time zones are not just offsets from GMT but a set of rules telling how to calculate the proper offset on any given date.  This site http://www.worldtimezone.com/ has maps for time zones.  You can see there that offset from GMT is not strictly observed.  Local law is the deciding factor.
0
 
LVL 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 250 total points
ID: 40572432
How can I know about DST and add the difference hours into the timezone ?
1. You can know about DST by checking the value of date('I').  This is shown in the article linked above, and documented in the PHP.net web site.
http://php.net/manual/en/function.date.php

2. You do not have to add the difference - the response from date() based on the settings of date_default_timezone_set() will give you the correct local time.  There is a large, open-source community that contributes to the underlying data model of the PHP language, and they are almost certainly correct about the issues of time zones and local laws and customs in any locale around the world.  Better to rely on them than try to do this all yourself!
0
 
LVL 36

Author Closing Comment

by:Loganathan Natarajan
ID: 40572481
Thanks experts. I understand now and I will handle it based on the Timezone.
0

Featured Post

Do you have a plan for Continuity?

It's inevitable. People leave organizations creating a gap in your service. That's where Percona comes in.

See how Pepper.com relies on Percona to:
-Manage their database
-Guarantee data safety and protection
-Provide database expertise that is available for any situation

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question