开发者

ROR + Ruby Date in Different Format

开发者 https://www.devze.com 2023-02-25 05:15 出处:网络
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\")

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"
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号