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

前端 未结 10 618
抹茶落季
抹茶落季 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:40

    In your time object, use the property .wday to get the number that corresponds with the day of the week, e.g. If .wday returns 0, then your date is Sunday, 1 Monday, etc.

提交回复
热议问题