我在用postgresql db和knex ORM構建一個使用node.js的應用程序。我有一個列類型date
。我以YYYY-MM-DD(2016/05/12)格式上傳日期數據。當我查看pgAdmin中的數據時,數據正確顯示爲2016/05/12。然而,當我檢索數據,其顯示格式爲:postgresql返回不正確的日期格式
Wed May 11 2016 20:00:00 GMT-0400 (EDT)
有誰知道爲什麼會發生?這裏是我的查詢:
knex('projects').where({
report_id: req.params.id
}).then(function(data) {
console.log(data[0].created_at); //returns Wed May 11 2016 20:00:00 GMT-0400 (EDT)
res.send(data);
}).catch(function(error) {
console.log('error: ' + error);
res.sendStatus(500);
});
查詢返回:
Wed May 11 2016 20:00:00 GMT-0400 (EDT)
- 這是關閉的,每天補充說,我沒有原來輸入到數據庫的其他信息。
有誰知道可能會發生什麼?
在此先感謝!
我不知道knex.js,但似乎客戶端的東西是將日期轉換爲自己選擇的東西,看看那裏。 –