Ruby midpoint between two dates

From EggeWiki

Jump to: navigation, search

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.

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"
Personal tools
Travelling Salesman

Get the app!