ROR + Ruby Date in Different Format
If I have @today = Thu Apr 21 2011 00:00:00 GMT 0530 (IST),
How do 开发者_高级运维I convert @today
into "Thur April 21, 2011"
?
Time.now.strftime("%a %B %d, %Y")
=> "Fri April 15, 2011"
In your occasion :
@today.to_time.strftime("%a %B %d, %Y")
=> "Thu April 21, 2011"
精彩评论