Hello,
I have looked at MySQL forums regarding timezones. My site is hosted in the US and I need to see results in the database in Australia. Needless to say the time will be at least 12 hours late. I have come to the conclusion that there is no way to amend the database, so is there a way to do it with PHP?
Thanks
Timestamp Timezone problems
Moderator: General Moderators
just add or subtract the hours for the given timezone using strtotime()
ex:
ex:
Code: Select all
$mountaintime = -8; //gmt - 8 hours for mountain standard time
$datetime = "06/30/2005 10:00:00";
echo date("m/d/Y g:i a", strtotime($datetime." ".$mountaintime." hours"));you'll have to update your table:
ex:
ex:
Code: Select all
$mountaintime = -8; //gmt - 8 hours for mountain standard time
$datetime = "06/30/2005 10:00:00";
$adjusted = date("Y-m-d g:i a", strtotime($datetime." ".$mountaintime." hours"));
mysql_query("update myTable set myDatetimefield = '$adjusted'")
or die(mysql_error());