Friday, December 3, 2010

Ruby's DateTime is treating "the Gregorian Conversion"

In Western world, there is the Gregorian Conversion. Fortunately, Ruby's DateTime class is treating this.

irb(main):001:0> require 'date'
=> true
irb(main):002:0> dt1015 = DateTime.new(1582,10,15)
=> #<DateTime: 1582-10-15T00:00:00+00:00 (4598321/2,0,2299161)>
irb(main):003:0> dt1015 - 1
=> #<DateTime: 1582-10-04T00:00:00+00:00 (4598319/2,0,2299161)>
irb(main):004:0> dt1111 = DateTime.new(1582,11,11)
=> #<DateTime: 1582-11-11T00:00:00+00:00 (4598375/2,0,2299161)>
irb(main):005:0> dt1111 << 1
=> #<DateTime: 1582-10-04T00:00:00+00:00 (4598319/2,0,2299161)>

No comments:

Post a Comment