Fix up timezone stuff

This commit is contained in:
2014-12-01 23:32:00 +11:00
parent 9a8ebbb5a8
commit 08a329417d
3 changed files with 7 additions and 6 deletions

View File

@@ -188,18 +188,19 @@ function _datearray_to_ts($date)
function _datetime_array_to_ts($date)
{
//watchdog('booking', 'Date-time Conversion: @info', array('@info' => var_export($date, TRUE)));
//watchdog('booking', "Date time conversion timezone configured as: @info", array('@info' => date_default_timezone(FALSE)));
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;
else
watchdog('booking', "Date array to timestamp: @info", array('@info' => var_export($date, TRUE)));
//else
// watchdog('booking', "Date array to timestamp: @info", array('@info' => var_export($date, TRUE)));
$gmt_ts = mktime($date['hour'], $date['minute'], 0, $date['month'], $date['day'], $date['year']);
$ts = new DateTime("@$gmt_ts");
$ts->setTimezone($tz);
//watchdog('booking', '<pre>Date-time Conversion: @info </pre>', array('@info' => print_r( $ts, true)));
return $ts->format("U");
}