Different PHP and MySQL date time -


i facing issue regarding date time returned php , mysql . checked php date, using

echo date("y-m-d h:m:s");  

it returned

2013-07-31 01:07:37  

then executed query in mysql console(phpmyadmin/sqlyog) query

select now() date_time  

it resulted

2013-07-31 15:40:36  

firslty want both should result dame date time, secondly how can set 1 of them match other one.

note: checked on local , live server both

apart typo in format codes, seems mysql , php not configured use same time zone. how find out?

in mysql:

mysql> select @@session.time_zone; +---------------------+ | @@session.time_zone | +---------------------+ | system              | +---------------------+ 1 row in set (0.00 sec) 

(in example, system means "the time zone of host machine".)

in php:

<?php echo date_default_timezone_get(); // europe/madrid 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -