4.39. kink/datetime/DAY_OF_WEEK¶
Provides day_of_week type.
4.39.1. type day_of_week¶
A day_of_week is one of:
• Monday (DAY_OF_WEEK.monday)
• Tuesday (DAY_OF_WEEK.tuesday)
• Wednesday (DAY_OF_WEEK.wednesday)
• Thursday (DAY_OF_WEEK.thursday)
• Friday (DAY_OF_WEEK.friday)
• Saturday (DAY_OF_WEEK.saturday)
• Sunday (DAY_OF_WEEK.sunday)
4.39.1.1. D.name¶
“name” method returns the name of the day_of_week, such as "monday", "tuesday" and "wednesday".
Postcondition:
• The result is a str which consists of ASCII lowercase letters.
Example:
:DAY_OF_WEEK.require_from('kink/datetime/')
stdout.print_line(DAY_OF_WEEK.friday.name.repr) # => "friday"
4.39.1.2. D.num¶
“num” method returns the int num of the day of week, with 1 being Monday, and 7 being Sunday.
Example:
:DAY_OF_WEEK.require_from('kink/datetime/')
stdout.print_line(DAY_OF_WEEK.friday.num.repr) # => 5
4.39.1.3. D.repr¶
“repr” method returns the str representation of the day of the week, such as "DAY_OF_WEEK.monday".
4.39.1.4. D1 < D2, D1 <= D2, D1 != D2, D1 == D2, D1 >= D2, D1 > D2¶
day_of_week values can be compared in the following total order.
• monday
• tuesday
• wednesday
• thursday
• friday
• saturday
• sunday
Example:
:DAY_OF_WEEK.require_from('kink/datetime/')
stdout.print_line((DAY_OF_WEEK.wednesday < DAY_OF_WEEK.thursday).repr) # => true
stdout.print_line((DAY_OF_WEEK.thursday == DAY_OF_WEEK.thursday).repr) # => true
stdout.print_line((DAY_OF_WEEK.friday > DAY_OF_WEEK.thursday).repr) # => true
4.39.2. DAY_OF_WEEK.monday¶
“monday” fun returns a day_of_week val with the following attributes:
• name: "monday"
• num: 1
4.39.3. DAY_OF_WEEK.tuesday¶
“tuesday” fun returns a day_of_week val with the following attributes:
• name: "tuesday"
• num: 2
4.39.4. DAY_OF_WEEK.wednesday¶
“wednesday” fun returns a day_of_week val with the following attributes:
• name: "wednesday"
• num: 3
4.39.5. DAY_OF_WEEK.thursday¶
“thursday” fun returns a day_of_week val with the following attributes:
• name: "thursday"
• num: 4
4.39.6. DAY_OF_WEEK.friday¶
“friday” fun returns a day_of_week val with the following attributes:
• name: "friday"
• num: 5
4.39.7. DAY_OF_WEEK.saturday¶
“saturday” fun returns a day_of_week val with the following attributes:
• name: "saturday"
• num: 6
4.39.8. DAY_OF_WEEK.sunday¶
“sunday” fun returns a day_of_week val with the following attributes:
• name: "sunday"
• num: 7
4.39.9. DAY_OF_WEEK.is?(Val)¶
DAY_OF_WEEK.is? fun returns whether Val is a day_of_week val.
4.39.10. DAY_OF_WEEK.from_num(Num)¶
`from_num` returns a `day_of_week` val `num` attribute of which is equal to `Num`.
Precondition:
• `Num` must be an int num in the range [1, 7]
Example:
:DAY_OF_WEEK.require_from('kink/datetime/')
stdout.print_line(DAY_OF_WEEK.from_num(1).repr) # => DAY_OF_WEEK.monday
stdout.print_line(DAY_OF_WEEK.from_num(7).repr) # => DAY_OF_WEEK.sunday