title: Conversion from ISO8601 Duration to Time and from Time to ISO8601 Duration
body: <p>I have duration value in ISO8601 format and I convert it to the value of time as an integer number of seconds as below:</p>
  
  <p>Duration value in ISO8601 format = "P1Y".</p>
  
  <pre><code>duration = ISO8601::Duration.new(params[:duration]).to_seconds
  
  # duration would have value in float, but I need it in int, so converting it to int.
  time_in_seconds = (Time.now - duration).to_i
  </code></pre>
  
  <p>I store the value in 'time_in_seconds'. So when I retrieve the value would be in int, which I want to convert back to ISO8601 duration format so I should get "P1Y" back after conversion.</p>
  
  <p>Is there a quick way to do this? Or will I have to convert the int value of Time to float and through some method convert it to ISO8601 duration.</p>