0
script/console
>> t = Time.at(1158609371)
=> Mon Sep 18 20:56:11 +0100 2006
>> t.zone
=> "BST"
>> s = Shop.find(:first)
>> s.creation_tsz = t.utc
=> Mon Sep 18 19:56:11 UTC 2006
>> s.creation_tsz.zone
=> "UTC"
>> s.save
>> s = Shop.find(:first)
>> s.creation_tsz
=> Sat Jan 01 19:56:11 UTC 2000
它从2006年9月18日到2000年1月1日是如何变化的?时区设置为在environment.rb中使用“UTC”。只是你知道我已经尝试了线s.creation_tsz = t.utc
的多种变化。所有失败。Ruby:将BST时间转换为UTC
从时间到日期时间改变了数据类型。固定。谢谢 – craig 2010-12-03 18:36:02