在模型模式中,
使用
updated: {
type: Date,
default: Date.now
在 server.js 中
put(function(req, res) {
var query = {name: req.params.name};
// use our bear model to find the bear we want
Domain.find(query, function(err, domains) {
if (err)
res.send(err);
var domain = domains[0];
domain.password = req.body.password; // update the bears info
domain.updated = new Date();
// save the bear
domain.save(function(err, data) {
if (err)
res.send(err);
res.json({ status: 'success', message: 'domain updated!' }, data);
});
});
});
然而,
在分贝侧它显示,
"updated": "2016-02-27T16:20:42.941Z"
但是,我的时区是 UTC+02.00
所以应该是 18:20:42
我做错了什么?
原文由 Aras Serdaroğlu 发布,翻译遵循 CC BY-SA 4.0 许可协议
我正在使用时刻时区
猫鼬中的模式。
看到
created_date, updated_date: {type: Date, default: dateThailand }
阅读更多: http: //momentjs.com/timezone/docs/
*如果您使用 Robo 3T 工具。
您可以设置“显示日期…”
:) 为我工作。