diff --git a/date_api/date_api_sql.inc b/date_api/date_api_sql.inc index a2adc65..be4f0d7 100644 --- a/date_api/date_api_sql.inc +++ b/date_api/date_api_sql.inc @@ -88,11 +88,16 @@ class date_sql_handler { /** * The object constuctor. */ - function __construct($date_type = DATE_DATETIME, $local_timezone = NULL, $offset = '+00:00') { + function __construct($date_type = DATE_DATETIME, $local_timezone = NULL, $offset = null) { $this->db_type = db_driver(); $this->date_type = $date_type; $this->db_timezone = 'UTC'; $this->local_timezone = isset($local_timezone) ? $local_timezone : date_default_timezone(); + if ($offset == null) { + $default_offset = (int)$this->get_offset(); + $offset = ($default_offset < 0) ? '-' : '+'; + $offset .= sprintf('%02s:%02s',intval(intval($default_offset)) / 3600, intval(($default_offset / 60) % 60) ) + } $this->set_db_timezone($offset); }