Module ActiveSupport::CoreExtensions::Numeric::Time
In: lib/active_support/core_ext/numeric/time.rb

Enables the use of time calculations and declarations, like 45.minutes + 2.hours + 4.years.

If you need precise date calculations that doesn‘t just treat months as 30 days, then have a look at Time#advance.

Some of these methods are approximations, Ruby‘s core Date and Time should be used for precision date and time arithmetic

Methods

ago   day   days   fortnight   fortnights   from_now   hour   hours   minute   minutes   month   months   second   seconds   since   until   week   weeks   year   years  

Public Instance methods

Reads best without arguments: 10.minutes.ago

day()

Alias for days

fortnight()

Alias for fortnights

from_now(time = ::Time.now)

Alias for since

hour()

Alias for hours

minute()

Alias for minutes

month()

Alias for months

second()

Alias for seconds

Reads best with argument: 10.minutes.since(time)

until(time = ::Time.now)

Alias for ago

week()

Alias for weeks

year()

Alias for years

[Validate]