I'm using the YouTube API and when I try to get the video duration the I receive PT11M41S
, so an ISO 8061. How can I get a PHP Date Object?
As you have already said yourself , you tried to get duration from Youtube API.Then the format you receive is not at all datetime but a duration (as expected ) based on ISO 8061 specifications .You can't simply convert this kind of duration to Datetime in PHP .That would be useless.However you can convert it to PHP DateInterval native object this way:
$duration = new DateInterval("PT11M41S");
From there you can format it as you want(in a human readable design) using the DateInterval::format() function
To know more about how to construct and use PHP DateInterval object you can take a look at :The DateInterval class