I am trying to find a way to display a difference in time between two locations using timezone function in PHP: http://php.net/manual/en/timezones.php
lets say I have ch
function get_timezone_offset( $origin_tz, $remote_tz ) {
$timezone1 = new DateTimeZone( $origin_tz );
$timezone2 = new DateTimeZone( $remote_tz );
$datetime1 = new DateTime("now", $timezone1);
$datetime2 = new DateTime("now", $timezone2);
$offset = $timezone1->getOffset($datetime1) - $timezone2->getOffset($datetime2);
return $offset;
}
$offset = get_timezone_offset( 'Europe/London', 'Asia/Shanghai' );
// convert offset to hours
echo $offset/3600;