0

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?

Mouaici_Med
  • 390
  • 2
  • 19
  • 1
    Have you checked this out? http://stackoverflow.com/questions/3721085/parse-and-create-iso-8601-date-and-time-intervals-like-pt15m-in-php – JustBaron Mar 08 '17 at 09:30
  • @justbaron thank you very much, effectively it answers my problem !! So if you want, make your answer in answer block and I will accept it :) – Mouaici_Med Mar 08 '17 at 09:38
  • 1
    Possible duplicate of [Parse and create ISO 8601 Date and time intervals, like PT15M in PHP](http://stackoverflow.com/questions/3721085/parse-and-create-iso-8601-date-and-time-intervals-like-pt15m-in-php) – jamek Mar 08 '17 at 12:08

1 Answers1

1

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

Community
  • 1
  • 1
JustBaron
  • 2,319
  • 7
  • 25
  • 37