diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 5474b8062e8..c8fc804c72a 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -83,7 +83,7 @@ function getServerTimeZoneString() function getServerTimeZoneInt($refgmtdate='now') { global $conf; - if (class_exists('DateTime') && ! empty($conf->global->MAIN_NEW_DATE)) + if (method_exists('DateTimeZone','getOffset') && ! empty($conf->global->MAIN_NEW_DATE)) { // Method 1 (include daylight) $gmtnow=dol_now('gmt'); $yearref=dol_print_date($gmtnow,'%Y'); $monthref=dol_print_date($gmtnow,'%m'); $dayref=dol_print_date($gmtnow,'%d'); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 77d071a0f6b..569d27a517d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -960,7 +960,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1) if ($second< 0 || $second > 60) return ''; } - if (class_exists('DateTime') && ! empty($conf->global->MAIN_NEW_DATE)) + if (method_exists('DateTime','getTimestamp') && ! empty($conf->global->MAIN_NEW_DATE)) { if (empty($gm)) $localtz = new DateTimeZone(date_default_timezone_get()); else $localtz = new DateTimeZone('UTC');