Replace hard coded timezone with function from date module

This commit is contained in:
2014-12-01 23:12:42 +11:00
parent 3a9c06e19a
commit 9a8ebbb5a8
4 changed files with 15 additions and 24 deletions

View File

@@ -170,8 +170,8 @@ function _booking_change_status($nid, $status_id)
function _datearray_to_ts($date)
{
date_default_timezone_set(TIMEZONE);
$tz = new DateTimeZone(TIMEZONE);
date_default_timezone_set(date_default_timezone(FALSE));
$tz = new DateTimeZone(date_default_timezone(FALSE));
if (empty($date) || ($date['month'] == '' && $date['day'] == '' && $date['year'] == ''))
return 0;
@@ -188,8 +188,8 @@ function _datearray_to_ts($date)
function _datetime_array_to_ts($date)
{
//watchdog('booking', 'Date-time Conversion: @info', array('@info' => var_export($date, TRUE)));
date_default_timezone_set(TIMEZONE);
$tz = new DateTimeZone(TIMEZONE);
date_default_timezone_set(date_default_timezone(FALSE));
$tz = new DateTimeZone(date_default_timezone(FALSE));
if (empty($date) || ($date['month'] == '' && $date['day'] == '' && $date['year'] == ''))
return 0;
@@ -207,8 +207,8 @@ function _datetime_array_to_ts($date)
function _date_to_ts($date) {
$date_split = _booking_split_date($date);
date_default_timezone_set(TIMEZONE);
$tz = new DateTimeZone(TIMEZONE);
date_default_timezone_set(date_default_timezone(FALSE));
$tz = new DateTimeZone(date_default_timezone(FALSE));
if ($date_split[0] == '-1' )
return 0;
@@ -226,8 +226,8 @@ function _date_to_ts($date) {
function _datetime_to_ts($date) {
$date_split = _booking_split_date($date);
date_default_timezone_set(TIMEZONE);
$tz = new DateTimeZone(TIMEZONE);
date_default_timezone_set(date_default_timezone(FALSE));
$tz = new DateTimeZone(date_default_timezone(FALSE));
if ($date_split[0] == '-1' )
return 0;
@@ -268,8 +268,8 @@ function _datetime_to_ts_nonstrict($date) {
return 0;
}
date_default_timezone_set(TIMEZONE);
$tz = new DateTimeZone(TIMEZONE);
date_default_timezone_set(date_default_timezone(FALSE));
$tz = new DateTimeZone(date_default_timezone(FALSE));
//$gmt_ts = mktime($date_split[5], $date_split[6], 0, $date_split[2], $date_split[1], $date_split[3]);
$gmt_ts = mktime($hour, $minute, $second, $month, $day, $year);
@@ -315,8 +315,8 @@ function _arrange_date($date) {
function _booking_convert_ts($timestamp)
{
//load the timestamp
date_default_timezone_set(TIMEZONE);
$tz = new DateTimeZone(TIMEZONE);
date_default_timezone_set(date_default_timezone(FALSE));
$tz = new DateTimeZone(date_default_timezone(FALSE));
$date = new DateTime("@$timestamp");
$date->setTimezone($tz);