【发布时间】:2019-06-14 11:17:44
【问题描述】:
如何更改猫鼬时间戳中的时区? 这里我有我的 jobSchema:
model.js:
const jobSchema = new Schema({
owner: {
type: Schema.ObjectId,
ref: 'User',
required: true
},
title: {
type: String
},
description: {
type: String
},
tag: {
type: String
},
....
}, {
timestamps: true,
toJSON: {
virtuals: true,
transform: (obj, ret) => { delete ret._id }
},
toObject: { virtuals: true }
})
时间的结果是:
"createdAt": "2019-01-21T04:35:20.076Z"
但我的实际时间是上午 11.35。
我想将时间戳 TimeZone 更改为 GMT/UTC +7。 是否有可能做到这一点?如果可能的话,我该怎么做?谢谢。
【问题讨论】:
标签: node.js rest mongoose timezone