Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How can I update the timezone based on US DST ?

Posted on 2015-01-22
6
Medium Priority
?
126 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
  • 2
  • 2
  • 2
6 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 1000 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 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 1000 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 1000 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 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 1000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
The viewer will learn how to count occurrences of each item in an array.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

916 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