Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我打印我的 TimeWithZone 对象,它将显示:
@issue.created_on.to_s "=> 2013-10-28 18:12:23 UTC "
我想知道一种打印 TimeZone 的方法,如下所示:
"=> 28/10/2013 18:12:23"
我该怎么做?
使用strftime:
strftime
Time.new(2013, 10, 28, 18, 12, 23).strftime("%d/%m/%Y %H:%M:%S") => "28/10/2013 18:12:23"