當在MYSQL中更新或創建記錄時,timestamp屬性存儲時間並從當前系統時間中減去0530hrs。我希望它按原樣存儲系統時間。Rails 3.1中的故障處理DateTime字段
下面是這樣的一個表:
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :username
t.string :first_name
t.string :last_name
t.timestamps
end
end
t.timestamps
創建了兩個附加字段:created_at
和updated_at
。這些字段存儲的時間不符合系統時間。
從數據庫
ID ENo Name created_at updated_at
38 EMP1 Puja 2012-02-16 05:05:15.650740 2012-02-17 04:58:01.728120
一些數據的實際創建時間是上午10時35分15秒在2012年2月16日和更新時間約爲10:28 AM現在在2月17日
什麼我的應用程序需要進行哪些更改才能實現此目的?
變化config.time_zone物業解決所有的問題,我的理解..謝謝披薩 – Puja 2012-02-17 08:12:29