W3cubDocs

/Crystal 0.31

struct Time::MonthSpan

Overview

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

Defined in:

time/span.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(value : Int)Source

Instance Method Detail

def ago : TimeSource

Returns a Time that happens N months before now.

def from_now : TimeSource

Returns a Time that happens N months after now.

def value : Int64Source

The number of months.

© 2012–2019 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.31.1/Time/MonthSpan.html