diff --git a/openstack/code/Presentation.php b/openstack/code/Presentation.php index e5ccd83..400cec8 100644 --- a/openstack/code/Presentation.php +++ b/openstack/code/Presentation.php @@ -1,5 +1,4 @@ StartTime); - return $Date->format('l h:i a'); + $start_time = trim(str_replace("p.m.", "", trim($this->StartTime))); + $date = DateTime::createFromFormat('d/m/y H:i', $start_time); + if (!$date) + $date = DateTime::createFromFormat('Y-m-d H:i:s', $start_time); + if ($date) + return $date->format('l h:i a'); + return 'N/A'; } function PresentationDay() { - $Date = new DateTime($this->StartTime); - return $Date->format('M d'); + $start_time = trim(str_replace("p.m.", "", trim($this->StartTime))); + $date = DateTime::createFromFormat('d/m/y H:i', $start_time); + if (!$date) + $date = DateTime::createFromFormat('Y-m-d H:i:s', $start_time); + if ($date) + return $date->format('M d'); + return 'N/A'; } - function onBeforeWrite() { parent::onBeforeWrite(); @@ -214,4 +223,3 @@ class Presentation extends DataObject } } } -