我在用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,但似乎客户端的东西是将日期转换为自己选择的东西,看看那里。 –