Difference between revisions of "Ruby - DateTime"

From PeformIQ Upgrade
Jump to navigation Jump to search
(Created page with '=Methods= ==>>(n) Method== From http://ruby-doc.org/core/classes/Date.src/M000677.html <pre> # File lib/date.rb, line 1273 def >> (n) y, m = (year * 12 + (mon - 1) + n)....')
 
 
Line 15: Line 15:
   end
   end
</pre>
</pre>
[[Category:Ruby]]

Latest revision as of 08:52, 19 March 2010

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