I am parsing an XML file using simpleXML to get the dates from the below data attributes:
<start_time>2012-01-22 09:00:00</start_time>
<stop_time>2012-03-18 15:00:00</stop_time>
using this:
echo 'Start Date:'.substr("$events->start_time", 0, 10).'<br />';
echo 'End Date:'.substr("$events->stop_time", 0, 10).'<br />';
My issue is that on some entries, there are no stop_time values given and when parsing the xml it pulls 0000-00-00 in the event there is nothing there. In plain terms this means the start_time and stop_time are the same day when this occurs in the xml file.
My Question:
How do I set start_time as the stop_time value for entries with no value given for stop_time?
Went with this as the parse wasn’t setting a value for stop_time: