标签: ruby ruby-on-rails-3 postgresql date
如果我有@today = Thu Apr 21 2011 00:00:00 GMT 0530 (IST),
@today = Thu Apr 21 2011 00:00:00 GMT 0530 (IST),
如何将@today转换为"Thur April 21, 2011"?
@today
"Thur April 21, 2011"
答案 0 :(得分:4)
Time.now.strftime("%a %B %d, %Y") => "Fri April 15, 2011"
在你的场合:
@today.to_time.strftime("%a %B %d, %Y") => "Thu April 21, 2011"