node.js - nodejs 中 mongoose created_at 时间问题
黄舟
黄舟 2017-04-17 16:00:14
0
1
632

mongoose 中 created_at字段的默认值 Date.now 是不是不能设置时区?如何设置?(默认: 都是格林威治时间)

created_at: { type: Date, default: Date.now }
黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(1)
左手右手慢动作

That’s not necessary. When used, offset the time to the required time zone, or use a function such as toLocalString.
default:function(){Date.now() +/- 你需要的时间}, this should save the time in the current time zone

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template