diff --git a/php/classes/TimeTableMgr.php b/php/classes/TimeTableMgr.php index 4244f65..1d0f425 100644 --- a/php/classes/TimeTableMgr.php +++ b/php/classes/TimeTableMgr.php @@ -333,13 +333,13 @@ class TimeTableMgr extends AmdaObjectMgr $descNumber = 0; foreach ($lines as $line) { - $line = preg_replace('/\s+/', ' ', trim($line)); + $line = preg_replace('/[-:\/\s]+/', ' ', trim($line)); if ($line[0] == '#') { // Comment $description = $description . PHP_EOL . substr($line, 1, -1); } else { $isoFormat = 'Y-m-dTH:i:s'; $doyFormat = 'Y z H i s'; - $doyRegex = '(\d{4}) (\d{2,3}) (\d{2}) (\d{2}) (\d{2})( \d{2})?'; + $doyRegex = '(\d{4}) (\d{3}) (\d{2}) (\d{2}) (\d{2})( \d{2})?'; if (preg_match('/^' . $doyRegex . ' ' . $doyRegex . '$/', $line)) { $start = DateTime::createFromFormat($doyFormat, substr($line, 0, 17)); @@ -349,8 +349,11 @@ class TimeTableMgr extends AmdaObjectMgr } else { $dateLength = round((strlen($line)-1) / 2); - $startTime = strtotime(substr($line, 0, $dateLength)); - $stopTime = strtotime(substr($line, $dateLength + 1)); + $start = explode(' ', substr($line, 0, $dateLength) . ' 00'); + $startTime = strtotime("$start[0]/$start[1]/$start[2] $start[3]:$start[4]:$start[5]"); + + $stop = explode(' ', substr($line, $dateLength + 1) . ' 00'); + $stopTime = strtotime("$stop[0]/$stop[1]/$stop[2] $stop[3]:$stop[4]:$stop[5]"); if (is_numeric($startTime) && is_numeric($stopTime)) { $startDate = date($isoFormat, $startTime); $stopDate = date($isoFormat, $stopTime); -- libgit2 0.21.2