Convert H standard: I to ISO 8601 standard

The length of time for the recipe is stored in my database as a string: "01:50" I am trying to convert it to the ISO 8601 standard without success.

This is what I use to call the field and parse it on the page:

$totalTime = ($extraField->value);
$itempr = "itemprop=\"totalTime\" content=\"$totalTime\"";

Similarly, it appears in the Google Structured Data Tool as “00:50,” which Google does not accept. As I understand it, it should look like this: PT1H50M

Anyone have any ideas on how to convert it to ISO 8601 format? Please keep in mind that I am not interested in developing using PHP, so be as explanatory as possible. Thanks!

+4
source share
1

:

echo (new DateTime('01:50'))->format('\P\TG\Hi\M');

TIME_FORMAT:

SELECT TIME_FORMAT('01:50', 'PT%kH%iM');
+7

All Articles