Ruby - DateTime

From PeformIQ Upgrade
Revision as of 08:52, 19 March 2010 by PeterHarding (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Methods

>>(n) Method

From http://ruby-doc.org/core/classes/Date.src/M000677.html

# File lib/date.rb, line 1273
  def >> (n)
    y, m = (year * 12 + (mon - 1) + n).divmod(12)
    m,   = (m + 1)                    .divmod(1)
    d = mday
    d -= 1 until jd2 = self.class.valid_civil?(y, m, d, fix_style)
    self + (jd2 - jd)
  end