var sidebar_align = 'right';
var content_container_margin = parseInt('350px');
var sidebar_width = parseInt('330px');
Getting the off-set hour between two timezone date
I am trying to write a simple script that will workout the off-set in hour, between 2 different timezone.
This is how i attempted it :
I ran this script on my local machine (which is in the UK, GMT Timezone). The result i expected to see was -5, because 'America/Toronto' is GMT -5, however, when i ran the script, it outputted -7 (which is wrong).
$new_tz = 'America/Toronto' ; // Based on http://uk3.php.net/manual/en/timezones.america.php
$current_hour = date ( 'h' );
date_default_timezone_set ( $new_tz ); // Based on http://uk3.php.net/manual/en/function.date-default-timezone-set.php
$new_hour = date ( 'h' );
echo 'Hour Difference : ' . ( $current_hour - $new_hour );
Where im i going wrong with this?
Just a thought, if the the time isnt in 24 hour time.. wouldnt you have to do some sort of date_subtract?
like if it was 12 and 5,... 12-5 = 7
but it's really 5 hours