Module: ActiveSupport::CoreExtensions::Numeric::Time

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

ago(time = ::Time.now)

Reads best without arguments: 10.minutes.ago

day()

Alias for days

days()
fortnight()

Alias for fortnights

fortnights()
from_now(time = ::Time.now)

Alias for since

hour()

Alias for hours

hours()
minute()

Alias for minutes

minutes()
month()

Alias for months

months()
second()

Alias for seconds

seconds()
since(time = ::Time.now)

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

until(time = ::Time.now)

Alias for ago

week()

Alias for weeks

weeks()
year()

Alias for years

years()

[Validate]