Time zone issue. urgent!

Discussion in 'PHP' started by afridy, May 4, 2012.

  1. #1
    Hai folks,

    i am running wamp server on a windows7 laptop.

    <?php 
    $timezone = "Asia/Riyadh"; 
    if(function_exists('date_default_timezone_set')){
      date_default_timezone_set($timezone); 
    }else{
      echo '********* ZONE NOT SET **********';
    }
    
    mysql_query("SET SESSION time_zone = '+3:00'"); ?> 
    Code (markup):
    echo date('Y-m-d H:i:s');
    
    Code (markup):
    result : 2012-05-05 18:19:26
    actual time now here : Saturday, 5 May 2012, 08:26:47 AST
    current laptop system tray clock shows : Saturday, 5 May 2012, 08:26 AM

    So the result timing is wrong. what could be the problem?
     
    afridy, May 4, 2012 IP
  2. DennisRitchieCollective

    DennisRitchieCollective Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Maybe the MySQL database is using a different time setting and not system time?
     
  3. afridy

    afridy Well-Known Member

    Messages:
    810
    Likes Received:
    116
    Best Answers:
    0
    Trophy Points:
    135
    #3
    Hai dennis,
    actually echo date('Y-m-d H:i:s'); have nothing to do with mysql as its a php command. so i think here mysql is not a concern.
     
    afridy, May 6, 2012 IP