$gmt_offset = get_option("gmt_offset",""); // 3.5 for example
$timezone_string = get_option("timezone_string",""); // America/Caracas for example
if(!empty($timezone_string)){
$tt = new DateTimeZone($timezone_string);
$time = new DateTime('now', $tt);
$gmt_offset = $time->format('O');
}
return $gmt_offset;
I am trying to get gmt offset in float format, where
3.5 hour is represented as (float)3.5
3 hours 15 minutes is (float)3.25
The problem is that DateTime::format() function does not have such format, and I could not find any relevant question.