Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Youtube API video duration format

{
 "kind": "youtube#videoListResponse",
 "etag": "\"XlbeM5oNbUofJuiuGi6IkumnZR8/ny1S4th-ku477VARrY_U4tIqcTw\"",
 "items": [
  {

   "id": "9bZkp7q19f0",
   "kind": "youtube#video",
   "etag": "\"XlbeM5oNbUofJuiuGi6IkumnZR8/HN8ILnw-DBXyCcTsc7JG0z51BGg\"",
   "contentDetails": {
    "duration": "PT4M13S",
    "dimension": "2d",
    "definition": "hd",
    "caption": "false",
    "licensedContent": true,
    "regionRestriction": {
     "blocked": [
      "DE"
     ]
    }
   }
  }
 ]
}

Youtube API v3 provides its video durations in this format "duration": "PT4M13S" Is this a standard time format? I'm trying to get a user friendly format using Objective-C. I would like to know if this is a Objective-C DateTime class supported format. If not what are those P,T, charactors stands for?

like image 665
Rukshan Avatar asked Dec 27 '22 06:12

Rukshan


1 Answers

That is an ISO 8601 time format. PT indicates that we are dealing with a time peroid. H, M, S and similar ones are obviously the duration in hours, minutes and seconds, etc. I am not sure if Objective-C is able to handle this natively, but you may be able to find something useful knowing how it works.

like image 115
jwueller Avatar answered Jan 14 '23 19:01

jwueller