How can I find the number of days between two Date objects in Ruby?
Subtract the beginning date from the end date:
endDate - beginDate
irb(main):005:0> a = Date.parse("12/1/2010")
=> #<Date: 4911063/2,0,2299161>
irb(main):007:0> b = Date.parse("12/21/2010")
=> #<Date: 4911103/2,0,2299161>
irb(main):016:0> c = b.mjd - a.mjd
=> 20
This uses a Modified Julian Day Number.
From wikipedia:
The Julian date (JD) is the interval of time in days and fractions of a day since January 1, 4713 BC Greenwich noon, Julian proleptic calendar.