Is there an add_days in ruby datetime?

后端 未结 6 1286
生来不讨喜
生来不讨喜 2020-12-25 10:59

In C#, There is a method AddDays([number of days]) in DateTime class.

Is there any kind of method like this in ruby?

6条回答
  •  感情败类
    2020-12-25 11:24

    The Date class provides a + operator that does just that.

    >> d = Date.today
    => #
    >> d.to_s
    => "2009-08-31"
    >> (d+3).to_s
    => "2009-09-03"
    >> 
    

提交回复
热议问题