title: Parse ISO 8601 time duration using Go (for instance PT90M)
body: <p>Is there any easy way to convert an ISO 8601 string time duration (<code>P(n)Y(n)M(n)DT(n)H(n)M(n)S</code>) to <code>time.Duration</code>?</p>
  <p>From <a href="https://en.wikipedia.org/wiki/ISO_8601#Durations" rel="nofollow noreferrer">Wikipedia on ISO 8601 durations</a>:</p>
  <blockquote>
  <p>For example, &quot;P3Y6M4DT12H30M5S&quot; represents a duration of &quot;three years, six months, four days, twelve hours, thirty minutes, and five seconds&quot;.</p>
  </blockquote>