This question already has an answer here:
- Format DateInterval as ISO8601 2 answers
Using PHP, I want to be able to go from a strtotime
relative time to a datetime interval that can be used for an iCalendar duration.
An example would be something like:
$date = \DateInterval::createFromString('5 minutes');
$period = $date->doSomeMagic();
echo $period; // should echo "PT5M"
Are there any built-in PHP functions to do this? Or if there aren't, is there a library that can do it?
</div>