Posts by Carlos Nicow • 21 points
2 posts
-
1
votes2
answers182
viewsA: Format "hour:minute" duration to ISO 8601 format
I did it this way: $duration = 05:25; $duration = preg_replace('/[:\/]/', 'M', $duration); echo 'PT' . $duration . 'S'; Upshot: PT05M25S
-
0
votes2
answers182
viewsQ: Format "hour:minute" duration to ISO 8601 format
I’m trying to turn the string 05:25 for PT05M25S. I made it this far, change the : for M. But I couldn’t insert the rest that was missing. $date = "05:25"; $date = preg_replace('/[:\/]/', 'M',…