The Youtube V3 API uses ISO8601 time format to describe the duration of videos. Something likes \"PT1M13S\". And now I want to convert the string to the number of seconds (for
The question Converting ISO 8601-compliant String to java.util.Date contains another solution:
The easier solution is possibly to use the data type converter in JAXB, since JAXB must be able to parse ISO8601 date string according to the XML Schema specification.
javax.xml.bind.DatatypeConverter.parseDateTime("2010-01-01T12:00:00Z")
will give you aCalendar
object and you can simply usegetTime()
on it, if you need aDate
object.