Mouaici_Med
Mouaici_Med

Reputation: 410

how to convert duration from ISO format PT1h30M to int duration basing on number of minutes in php?

I want to convert a duration from ISO 8601 format to an integer by computing the number of minute in this duration. For exemple if I have PT1h30M , I want to convert it to 90, because I need to store this inforamtion in my data base as integer (the number of minute). is there any function in PHP to do this?

Upvotes: 0

Views: 2872

Answers (1)

JustBaron
JustBaron

Reputation: 2347

There are a few answers out there relating to conversion of ISO 8601 format.

Check out PHP 5.3+ DateInterval

Also, Parse and create ISO 8601 Date and time intervals, like PT15M in PHP

Upvotes: 1

Related Questions