Hi Richard, I looked around a bit and it does seem clunky to convert a HH:MM:SS string to a DateInterval object. Why not store the buffer time as seconds only, and then do something like $date = new DateTime($event_datetime); $date->add(new DateInterval('P'.$buffer_time.'S')); echo $date->format('Y-m-d') . "\n"; Marc On 7 April 2015 at 07:45, Richard Quadling <rquadling@xxxxxxxxx> wrote: > Hi. > > This sort of stuff always makes me wonder what it is I am missing. > > The users are asked to enter a buffer time in the format HH:MM > > This time will be added to the end of an event datetime to determine what > the next available event will be for that user. > > The entered value is stored in the DB as a time type (so is returned as a > string "HH:MM:SS"). > > Can I use anything in DateTime to handle this (I was thinking of > DateTimeInterval but that doesn't want to deal with a simple time only > string). > > My other option is to parse out the string into H, M and S and then > construct that as a strtotime sort of thing. > > In general, this sort of parsing always suggests I've missed a > trick/function/method. > > So, is there something I'm missing? > > Regards, > > Richard. > > > > -- > Richard Quadling > Twitter : @RQuadling > EE : http://e-e.com/M_248814.html > Zend : http://bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php