Adding a relative amount of time to an absolute time.
| From: | Richard Quadling | Date: | Tue, 07 Apr 2015 11:45:31 +0000 |
| Subject: | Adding a relative amount of time to an absolute time. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-324771@lists.php.net to get a copy of this message | ||
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