我有
Rails 3.0.9
Activerecord-sqlserver-adapter 3.0.15
TinyTds
MSSQL 2005
我在使用 Time.now 时遇到问题。
这就是我在控制台中所做的:
有人可以解释这种行为吗?
irb(main):026:0> row = Eclaim.where(:id => 1).first
=> #<Eclaim id: 1, id_user: 1, property: "inv", app_number: nil, patent_number:
nil, native_number: nil, title: nil, applicants: nil, receive_date: nil, change_
date: "2012-05-08 10:20:44">
irb(main):027:0> row[:change_date] = Time.now
=> 2012-05-08 13:37:13 +0300
irb(main):028:0> row.save
=> true
irb(main):029:0> row = Eclaim.where(:id => 1).first
=> #<Eclaim id: 1, id_user: 1, property: "inv", app_number: nil, patent_number:
nil, native_number: nil, title: nil, applicants: nil, receive_date: nil, change_
date: "2012-05-08 10:37:13">
irb(main):047:0> Time.zone
=> (GMT+00:00) UTC
为什么我在数据库中得到日期2012-05-08 10:37:13而不是2012-05-08 13:37:13 +0300?