SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Time problem

  1. #1
    SitePoint Zealot dizyn's Avatar
    Join Date
    Apr 2006
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Time problem

    Hi,

    My server is based in USA and it's mysql database time is EST. It's a shared server and i cannot change it's time. I don't want to use EST infact i want to use GMT + 5 time.

    for example i save something in database and timestamp saved current timestamp that's EST when i access it i want to show it in GMT+5

    How can i do that?

    thank you

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,495
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    EST = GMT - 5
    your time = GMT + 5

    your time = EST + 10

    So you could add 10 hours to the timestamp you get from your database.

  3. #3
    SitePoint Zealot dizyn's Avatar
    Join Date
    Apr 2006
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Solution:

    mysql_query("SET time_zone = '+5:00'") or die();

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,036
    Mentioned
    187 Post(s)
    Tagged
    2 Thread(s)
    Don't forget about daylight savings time. The difference alternates between -4 and -5 depending on the time of year.

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,216
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Mittineague View Post
    ... depending on the time of year.
    and also on where you are
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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