Get name of the day

删除回忆录丶 提交于 2020-08-06 13:12:11

问题


how can I get the name of the day in Ruby.

For eg. something like that:

a = Date.today
a.day_name 
  => Tuesday

the only thing i could find was .wday but that only returns for the number of the day in the week

a.wday 
  => 2

回答1:


Time.now.strftime("%A")
# => "Tuesday"

or

Date.today.strftime("%A")
# => "Tuesday"


来源:https://stackoverflow.com/questions/29365439/get-name-of-the-day

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!