/** * Format and adjust date/time to GMT+0 for log or incoming SMS saving purposes * * @param $time date/time * @param $tz timezone * @return formatted date/time with adjusted timezone */ function core_adjust_datetime($time, $tz = 0) { global $core_config, $user_config; $time = trim($time); $ret = $time; if ($time && $time != '0000-00-00 00:00:00') { if (!$tz) { if (!($tz = $user_config['datetime_timezone'])) { $tz = $core_config['main']['gateway_timezone']; } } $time = strtotime($time); $off = core_datetime_offset($tz); // the difference between core_display_datetime() and core_adjust_datetime() // core_adjust_datetime() will set to GTM+0 (-offset) $ret = $time - $off; $ret = date($core_config['datetime']['format'], $ret); } return $ret; }
function core_adjust_datetime($time, $tz = 0) { global $core_config; $gateway_module = $core_config['module']['gateway']; if (!$tz) { if (!($tz = $core_config['plugin'][$gateway_module]['datetime_timezone'])) { $tz = $core_config['main']['cfg_datetime_timezone']; } } $time = strtotime($time); $off = core_datetime_offset($tz); // the difference between core_display_datetime() and core_adjust_datetime() // core_adjust_datetime() will set to GTM+0 (-offset) $ret = $time - $off; $ret = date($core_config['datetime']['format'], $ret); return $ret; }