Php timezones, mysql dates.
Posted: Sun Feb 05, 2006 9:15 am
Hi,
I use putenv('TZ= to change the time zone in a script...
what I want is to find the time difference between mysql and the new time from php and use it on mysql...
I don't want to use 'SET time_zone=' in mysql because only works after some version...
iI supose I should do something like:
$mysql_time = mysql datetime
$php_time = date("Y-m-d H:i:s")
now my problem is how to get the time difference between these two so I can use it in a query like:
SELECT now()
and get the same datetime as in php?
(probably use addtime but still I'm very confused! :( )
ps. really sorry if this makes no sense
I use putenv('TZ= to change the time zone in a script...
what I want is to find the time difference between mysql and the new time from php and use it on mysql...
I don't want to use 'SET time_zone=' in mysql because only works after some version...
iI supose I should do something like:
$mysql_time = mysql datetime
$php_time = date("Y-m-d H:i:s")
now my problem is how to get the time difference between these two so I can use it in a query like:
SELECT now()
and get the same datetime as in php?
(probably use addtime but still I'm very confused! :( )
ps. really sorry if this makes no sense