Add in seconds, some timestamps have those and date doesn't parse otherwise

This commit is contained in:
Nathan Gray 2012-04-23 16:32:34 +00:00
parent 07d22ef3be
commit 0e9e4ae325

View File

@ -1051,18 +1051,24 @@ abstract class bo_merge
$key = '$$'.$field.'$$'; $key = '$$'.$field.'$$';
$field = preg_quote($field, '/'); $field = preg_quote($field, '/');
if($values[$key]) if($values[$key])
{
if(!is_numeric($values[$key]))
{ {
try { try {
$date = egw_time::createFromFormat( $date = egw_time::createFromFormat(
'!'.egw_time::$user_dateformat . ' ' .egw_time::$user_timeformat, '!'.egw_time::$user_dateformat . ' ' .egw_time::$user_timeformat.':s',
$values[$key], $values[$key],
egw_time::$user_timezone egw_time::$user_timezone
); );
} catch (Exception $e) { } catch (Exception $e) {
// Couldn't get a date out of it... skip it // Couldn't get a date out of it... skip it
trigger_error("Unable to parse date $key = '{$values[$key]}' - left as text", E_USER_NOTICE); trigger_error("Unable to parse date $key = '{$values[$key]}' - left as text", E_USER_NOTICE);
} }
}
else
{
$date = new egw_time($values[$key]);
}
if($mimetype == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')//Excel WTF if($mimetype == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')//Excel WTF
{ {
$interval = $date->diff(new egw_time('1900-01-00 0:00')); $interval = $date->diff(new egw_time('1900-01-00 0:00'));