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
Php timezones, mysql dates.
Moderator: General Moderators
- burnthewitches
- Forum Newbie
- Posts: 4
- Joined: Sat Feb 04, 2006 7:14 pm
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
it can be suggested that simply storing the unix timestamp from php can work easiest. time() will return the local time, gmmktime() will return the current time in GMT (use this) .. since that is a known reference, you can then use simple math to offset it to any timezone.
- burnthewitches
- Forum Newbie
- Posts: 4
- Joined: Sat Feb 04, 2006 7:14 pm