我似乎找不到这个,我觉得应该很容易.在Ruby on Rails中,我该如何处理:
2010-06-14 19:01:00 UTC
把它变成
June 14th, 2010
我可以不在视图中使用辅助对象吗?
我似乎找不到这个,我觉得应该很容易.在Ruby on Rails中,我该如何处理:
2010-06-14 19:01:00 UTC
把它变成
June 14th, 2010
我可以不在视图中使用辅助对象吗?
我不知道为什么
June 14th, 2010
但是如果你想
June 14, 2010
参考文献how do i get name of the month in ruby on Rails?或this
就这么做吧
@date = Time.now
@date.strftime("%B %d, %Y")
后缀使用如下
@date.strftime("%B #{@date.day.ordinalize}, %Y") # >>> Gives `June 18th, 2010`