enum Time::DayOfWeek
¶
DayOfWeek
represents a day of the week in the Gregorian calendar.
time = Time.local(2016, 2, 15)
time.day_of_week # => Time::DayOfWeek::Monday
Each member is identified by its ordinal number starting from Monday = 1
according to ISO 8601.
#value
returns this ordinal number. It can easily be converted to the also
common numbering based on Sunday = 0
using value % 7
.
Members¶
Monday = 1
¶
1
Tuesday = 2
¶
2
Wednesday = 3
¶
3
Thursday = 4
¶
4
Friday = 5
¶
5
Saturday = 6
¶
6
Sunday = 7
¶
7
Class methods¶
.from_value(value : Int32) : self
¶
(value : Int32) : self
Returns the day of week that has the given value, or raises if no such member exists.
This method also accepts 0
to identify Sunday
in order to be compliant
with the Sunday = 0
numbering. All other days are equal in both formats.