From c15d6becfd7621fe85483af974ce4090d5b9b55e Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 12 Sep 2017 22:10:26 +0200 Subject: [PATCH] fix timezone offset manually --- build/service/CalendarExtractor.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/build/service/CalendarExtractor.php b/build/service/CalendarExtractor.php index 5351e90..3f2c798 100644 --- a/build/service/CalendarExtractor.php +++ b/build/service/CalendarExtractor.php @@ -244,11 +244,17 @@ /* [3] Convert to UTC (+0) =========================================================*/ - /* (1) Get local timestamp */ - $ts = strtotime("${day} $hour:$min:00"); + /* (1) Get local timezone */ + $tz = date_default_timezone_get(); - /* (2) Return UTC date */ - return gmdate("Ymd\THis", $ts); + /* (2) Get timezone offset */ + $tz_offset = get_timezone_offset($tz); + + /* (3) Get GMT (UTC+0) timestamp */ + $ts = strtotime("${day} $hour:$min:00") + $tz_offset; + + /* (4) Return GMT date */ + return date("Ymd\THis", $ts); }