Skip to content

struct Time::MonthSpan
inherits Struct

Represents a number of months passed. Used for shifting Times by a specified number of months.

Time.local(2016, 2, 1) + 13.months # => 2017-03-01 00:00:00
Time.local(2016, 2, 29) + 2.years  # => 2018-02-28 00:00:00

Class methods

.new(value : Int)

View source

Methods

#ago : Time

Returns a Time that happens N months before now.

View source

#from_now : Time

Returns a Time that happens N months after now.

View source

#value : Int64

The number of months.

View source