Plain-English convenience methods module designed for the Time class.

Methods
Constants
NEVER = Time.mktime(2038)
ZERO = Time.mktime(1972)
Public Instance methods
ago(seconds) [ source ]

Returns a new Time representing the time a number of seconds ago. Do not use this method in combination with x.months, use months_ago instead!

at_beginning_of_day()

Alias for beginning_of_day

at_beginning_of_month()

Alias for beginning_of_month

at_beginning_of_week()

Alias for beginning_of_week

at_beginning_of_year()

Alias for beginning_of_year

at_midnight()

Alias for beginning_of_day

beginning_of_day() [ source ]

Returns a new Time representing the start of the day (0:00)

This method is also aliased as midnight at_midnight at_beginning_of_day start_of_day
beginning_of_month() [ source ]

Returns a new Time representing the start of the month (1st of the month, 0:00)

This method is also aliased as at_beginning_of_month
beginning_of_week() [ source ]

Returns a new Time representing the "start" of this week (Monday, 0:00)

This method is also aliased as monday at_beginning_of_week
beginning_of_year() [ source ]

Returns a new Time representing the start of the year (1st of january, 0:00)

This method is also aliased as at_beginning_of_year
in(seconds)

Alias for since

in_day_range?(stime=ZERO, etime=NEVER) [ source ]

Returns true only if day of time is included in the range (stime..etime). Only year days are checked.

last_month() [ source ]

Short-hand for months_ago(1)

last_year() [ source ]

Short-hand for months_ago(1)

midnight()

Alias for beginning_of_day

monday()

Alias for beginning_of_week

months_ago(months) [ source ]

Returns a new Time representing the time a number of specified months ago.

months_since(months) [ source ]
next_month() [ source ]

Short-hand for months_since(1)

next_week(day = :monday) [ source ]

Returns a new Time representing the start of the given day in next week (default is Monday).

next_year() [ source ]

Short-hand for months_since(1)

seconds_since_midnight() [ source ]

Seconds since midnight: Time.now.seconds_since_midnight

since(seconds) [ source ]

Returns a new Time representing the time a number of seconds since the instance time. Do not use this method in combination with x.months, use months_since instead!

This method is also aliased as in
start_of_day()

Alias for beginning_of_day

to_end_of_day() [ source ]

Rrturns a new time at end of day

to_start_of_day() [ source ]

Returns a new time at start of day

tomorrow() [ source ]

Convenience method which returns a new Time representing the time 1 day since the instance time

years_ago(years) [ source ]

Returns a new Time representing the time a number of specified years ago.

years_since(years) [ source ]
yesterday() [ source ]

Convenience method which returns a new Time representing the time 1 day ago