PHP Time zone problem is killing me

Hai folks,

i am running wamp server on my windows7 laptop.

php.ini

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Asia/Riyadh

my script

date_default_timezone_set('Asia/Riyadh'); 
putenv("TZ=Asia/Riyadh"); // i put this also since previous one also not correctly showing..
echo date('Y-m-d H:i:s');

php shows wrong date. it says 2012-05-05 02:49:58
but its now 2012-04-05 16:53:20 here in Riyadh.

whats wrong. i restarted several times the server also .

<?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'"); 
?> 


apparently MySQL doesnt support Asia/Riyadh hence the seperate setting for your database

Thank you for the reply.
i did exactly as shown above.
unfortunately still shows the wrong date


<?php 
$timezone = "Asia/Riyadh"; 
if(function_exists('date_default_timezone_set')){
  date_default_timezone_set($timezone); 
}else{
  echo 'Warning! Time zone not correctly set.';
}

mysql_query("SET SESSION time_zone = '+3:00'"); 
?> 

echo date('Y-m-d H:i:s');

2012-05-05 05:48:20

I assume that the time and date are set correctly on the machine your running Wamp on

I know, but Ive gotta ask

yes mandes, its correctly set.

when i mouse over system tray clock it shows Friday, May 4 2012 :slight_smile:

btw, i put back the php.ini to its default : date.timezone = UTC

btw, current date and time in riyadh for your referrence
Friday, May 4, 2012 at 8:19:32 PM AST