Add and subtract six months using the >> and << methods. : Date Calculation « Date « Ruby
- Ruby
- Date
- Date Calculation
Add and subtract six months using the >> and << methods.
require 'date'
date = Date.new( 2006, 11, 8 )
puts (date >> 6).to_s
puts (date << 6).to_s
Related examples in the same category