From: Daniel Berger Date: 2005-09-28T00:24:10+09:00 Subject: Re: Time interval Gavin Kistner wrote: > On Sep 27, 2005, at 2:51 AM, Robert Klemme wrote: > >> Daniel Berger wrote: >> >>> Robert Klemme wrote: >>> >>>> Note that it's easy to output difference in seconds, minutes, hours, >>>> days and weeks but then it starts to get more difficult. >>> >>> You mean with the existing DateTime class? How? I thought this was >>> possible, but my Google skills appear to be failing me at the moment. >>> My own experiments weren't much better. >> >> No, I mean because of the underlying model (our calendar). Months have >> different lengths. Same for years and quarters. > > > For example: > > require 'date' > d1 = DateTime.parse( "2/1/2000" ) > d2 = DateTime.parse( "3/2/2000" ) > puts d2-d1 #=> 30 > > Should the human-readable difference in that time say: > 1 month, 1 day > 30 days > 1 month > ? I wouldn't try to get more specific than *days*. :) Regards, Dan