views:

169

answers:

0

According to wikipedia - en.wikipedia.org/wiki/ISO_8601 , it should be possible to do this (assuming PHP supports the full ISO 8601):

$date = new DateTime(date('Y-m-d H:i:s', time())); // current time - create date time object
date_add($date, new DateInterval("PT".round(2.5,2)."H")); //add 2.5 hours (throws exception unknown or bad format)
$eventEnd = $date->format("Y-m-d\TH:i:sP");

But I get an exception that it is a bad format. If I round to 0 decimal places, it works fine. So PHP does not seem to be accepting the decimal.

My source data may include a decimal, so I need to account for that somehow. ?