看板 Database 關於我們 聯絡資訊
資料庫名稱: Postgresql 資料庫版本: 9.3 內容/問題描述: 我想得到已存在timestamp欄位的整數值, 欄位格式是:timestamp without time zone 看到有語法可以這樣做 SELECT EXTRACT(epoch from 欄位名), 單位:second 但對於epoch, 官方文件中寫到: "For timestamp with time zone values, the number of seconds since 1970-01-01 00:00:00 UTC (can be negative); for date and timestamp values, the number of seconds since 1970-01-01 00:00:00 local time;..." 後面那句應該是指timestamp without time zone類型, 所以對此類型而言, 得到的epoch 值有考量db的時區進去 我原本存進欄位的值都是 UTC, 但用那語法取出來的是含db時區的值, 想得到原本UTC的 值應該如何做? 謝謝~ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.162.18.188 ※ 文章網址: https://www.ptt.cc/bbs/Database/M.1443840052.A.9E1.html ※ 編輯: flowwinds (1.162.18.188), 10/03/2015 10:45:09