Reply To: Timezone problem with hourly calendar

I just use the normal PHP time(); function that not depends on time zones and compares it with a timestamp of the date of the column and the time of row that’s independed on time zones either. You have to use date_default_timezone_set();

time() returns a UNIX timestamp, which is timezone independent.

Since a UNIX timestamp denotes the seconds since 1970 UTC you could say it's UTC, but it really has no timezone. It will be calculated based on the set timezone though, so if your timezone is set incorrectly, the timestamp will be off. You need to use date_default_timezone_set either way.

To be really clear, a UNIX timestamp is the same value all over the world at any given time. At the time of writing it's 1296096875 in Tokyo, London and New York. To convert this into a "human readable" time, you need to specify which timezone you want to display it in. 1296096875 in Tokyo is 2011-01-27 11:54:35, in London it's 2011-01-27 02:54:35 and in New York it's 2011-01-26 21:54:35.

Conversely, when creating a UNIX timestamp your system needs to consider your local time and its timezone to come up with the correct timestamp.

Maybe something like this:

Select Code
function easyreservations_set_default_time(){
add_action('init', 'easyreservations_set_default_time');

in your themes function.php or an own plugin.