SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    changing the default time in mySql

    Hi all

    I have the following query:

    PHP Code:
     $query1 "INSERT INTO whoisonline VALUES (NULL,'$memberid', FROM_UNIXTIME('$lastlogin'), '$loggedfromip')"
    This query works like a charm, however, I have the following problem.
    The time inserted is local time on server which beloing to time zone 'America/Denver'

    I would like the time inserted to be 'Europe/Athens' time zone. I try with:

    PHP Code:
    date_default_timezone_set('Europe/Athens'); 
    without any success however. Any help will be deeply appreciated.

    Regards, Zoreli

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,274
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    this should help -- MySQL Server Time Zone Support
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi r937

    It won't, since I am on shared hosting. I have no permissions to do any of the things mentioned on the page. Any other way? Any idea how to rewrite the query eventually?

    Regards, Zoreli

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,274
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by zoreli View Post
    Any other way?
    sure

    instead of inserting FROM_UNIXTIME($lastlogin), insert FROM_UNIXTIME($lastlogin + 8*60*60)

    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
  •