views:

76

answers:

1

Hello,

I've set up a quick little test to understand and debug timezones between mySQL and PHP.

Here's the page: http://dev.feedingo.com/test_dates.php

The dates are being created in mySQL using NOW() in a datetime field. The initial problem I was trying to figure out is what timezone mySQL is using and how to sync it up with PHP. But now there's an even weirder issue.

In my test app, if you change your timezone, the first strtotime updates properly, but if you pass it into a date() function it doesn't change. This is how im setting the timezone based off the select box.

    $current_timezone = 'America/New_York';
if( isset( $_GET['timezone'] ) ) $current_timezone = $_GET['timezone'];

date_default_timezone_set($current_timezone);

Any ideas as to why the date() function isn't accepting the timezone changes? Thanks!

+1  A: 
timdev