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日に変更されましたか?タイムゾーンは環境変数 "UTC"を使用するように設定されています。そして、あなたは私がラインs.creation_tsz = t.utc
の多数の変形を試みたことを知っているだけです。すべてが失敗した。Ruby:BST時間をUTCに変換
時刻がdatetimeに変更されました。一定。ありがとう – craig