Ruby midpoint between two dates

From EggeWiki
Revision as of 23:43, 9 July 2009 by Brianegge (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

I needed to find the midpoint between to dates. Unfortunately, I didn't have my HP12C handy, so I executed calculated the same in ruby.

<geshi lang="ruby"> require 'date' => true (Date.new(2009,07, 01) - Date.new(2009, 04, 01)).to_i => 91 (Date.new(2009, 04, 01) + 45).to_s => "2009-05-16" </geshi>