How can I calculate the day of the week of a date in ruby?

前端 未结 10 592
抹茶落季
抹茶落季 2020-12-01 05:05

How can I calculate the day of the week of a date in Ruby? For example, October 28 of 2010 is = Thursday

10条回答
  •  醉梦人生
    2020-12-01 05:24

    Say i have date = Time.now.to_date then date.strftime("%A") will print name for the day of the week and to have just the number for the day of the week write date.wday.

提交回复
热议问题