instance method Time#wday

wday -> Integer[permalink][rdoc]

曜日を0(日曜日)から6(土曜日)の整数で返します。

sun = Time.new(2017, 9, 17, 10, 34, 15, '+09:00') #=> 2017-09-17 10:34:15 +0900
sun.wday                                          #=> 0
mon = Time.new(2017, 9, 18, 10, 34, 15, '+09:00') #=> 2017-09-18 10:34:15 +0900
mon.wday                                          #=> 1
tue = Time.new(2017, 9, 19, 10, 34, 15, '+09:00') #=> 2017-09-19 10:34:15 +0900
tue.wday                                          #=> 2
wed = Time.new(2017, 9, 20, 10, 34, 15, '+09:00') #=> 2017-09-20 10:34:15 +0900
wed.wday                                          #=> 3
thu = Time.new(2017, 9, 21, 10, 34, 15, '+09:00') #=> 2017-09-21 10:34:15 +0900
thu.wday                                          #=> 4
fri = Time.new(2017, 9, 22, 10, 34, 15, '+09:00') #=> 2017-09-22 10:34:15 +0900
fri.wday                                          #=> 5
sat = Time.new(2017, 9, 23, 10, 34, 15, '+09:00') #=> 2017-09-23 10:34:15 +0900
sat.wday                                          #=> 6