Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: default timezone

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Scott's Avatar
    Scott is offline Certified Glow Sage
    Join Date
    Oct 2006
    Posts
    27

    Default

    We are in the same boat.

    I was also looking for a way to set a domains timezone through CPanel because server logs are also annoying with the timestamps written to system time. Or possiblely through some Apache directive that could be added to htaccess file.

    I am going to check further on the Apache thing and post back results.

  2. #2
    Scott's Avatar
    Scott is offline Certified Glow Sage
    Join Date
    Oct 2006
    Posts
    27

    Default

    Well you can set your env variable using an Apache directive. Place this line in your .htaccess file in your document root directory:

    SetEnv TZ America/Chicago

    After placing this in my .htaccess file, PHP works like a champ and you no longer have to make the adjustment in your PHP code. However, MySQL still requires the per connection manipulation.

  3. #3
    Dmitriy is offline Nearly a Master Glow Jedi
    Join Date
    Feb 2007
    Location
    Ukraine
    Posts
    124

    Default

    Well, yes, PHP uses server local time. You can obtain if local server time is in DST (call date('I')). As for MySQL - it depends on configuration. Check MySQL manual: A.4.6. Time Zone Problems.

    However, from the PHP script you can't determine if (let's say the server is in Florida) if in New Ziland is used DST right now. See: About Daylight Saving Time. That is why many PHP applications have 'Use DST' in options (it simply adds 1 hour to the user timezone).

    JM, Scott, any comments?

    Very interesting situation arises, when user says his timezone is GMT +2 & he is in country that uses DST..... so what the current user time is? Anybody knows for sure?

  4. #4
    Dmitriy is offline Nearly a Master Glow Jedi
    Join Date
    Feb 2007
    Location
    Ukraine
    Posts
    124

    Default

    Finally, after few hours of searching, found & tested a script. Seems working good:
    Timezone and Daylight Saving Time Script
    However, I wasn't able to check many timezones... Have a look at it

  5. #5
    Matt's Avatar
    Matt is offline GlowHost Administrator
    Join Date
    Jan 2005
    Location
    Behind your monitor
    Posts
    6,398

    Default

    From his site:

    At the time of writing this, I am aware that the United States is considering passing legislation that would change their daylight savings time rules with Canada to possibly follow suit. Once these new rules are made official, I will make an effort to update this script to reflect the changes.
    I believe this was passed this year. Though I forget what it was, I think what it entailed was a change to the date that DST was recognized on.

    Can anyone confirm or deny that the changes have already been made?
    Send your friends and site visitors to GlowHost and get $125 plus bonus!
    GlowHost Affiliate Program | Read our Blog | Follow us on X |

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13