# Building time interval

**URL:** <https://rubytalk.org/t/building-time-interval/10635>\
**Category:** ruby-talk\
**Created:** [18 March 2004 15:04 UTC](https://rubytalk.org/t/building-time-interval/10635 "2004-03-18T15:04:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laurent\_Julliard4](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@Laurent\_Julliard4](https://rubytalk.org/u/Laurent_Julliard4)\
**Post date:** [18 March 2004 15:04 UTC](https://rubytalk.org/t/building-time-interval/10635/1 "2004-03-18T15:04:32Z")

</div>

hi gurus and nubys,

I wonder: is there a simple way to build a relative time object from  
seconds?

I mean something like:

t= [Time.gm](http://Time.gm)(5,‘jan’,1,1,1,1)  
t2= [Time.gm](http://Time.gm)(5,‘feb’,1,1,1,1)

interval= t2 - t1  
p Time.from\_interval interval  
"4 weeks 3 days 0 hours 0 minutes 0 seconds "

(probably not, but the date/time world is quite onscure to me, and in  
ruby it’s quite large)
