I have data like following
PT45M
PT1H30M
How can i get an output like
45 min
1 hour 30 min
Is there any function in php to get output like shown?
$dur="PT45M";
$d = new DateInterval($dur);
$duration=$d->format('%h hour %m min');
$duration=str_replace(" 0 min", "",$duration );
$duration=str_replace("0 hour", "",$duration );
This is one solution almost worked for me. But on PT45M it is showing 0 hour. :( It may be a simple function, but am unable to find a solution. Have spent a lot of time in googleing :( Hope someone can help me with this.