how do I get name of the month in ruby on Rails?

后端 未结 6 947
眼角桃花
眼角桃花 2021-02-05 00:12

so i create in my view:

<%=date=Date.today%>

How do i get the name of the month out of the date? I was trying to do sth like



        
6条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-05 00:15

    Ref this

    <% @date = Date.today  %>  
    <%= @date.strftime("%B")%>
    

    if

    @date >> Fri, 11 Jun 2010
    

    then

    @date.strftime("%B") >> "June"
    

提交回复
热议问题