4
{
 "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?

4

2 回答 2

10

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.

于 2013-03-30T17:49:09.267 回答
0

this might help a bit, nevertheless this this an overkill, just to show video length.

http://en.wikipedia.org/wiki/ISO_8601#Durations

于 2014-03-19T00:14:41.077 回答