When I put in MongoDB schema :
created: { type: Date, default: Date.now }
The time is 3 hours too long.
How can I fix this?
When I put in MongoDB schema :
created: { type: Date, default: Date.now }
The time is 3 hours too long.
How can I fix this?
MongoDB
works with UTC, that is, unfixed time zone. You will always have to consider this when using Date
.
Since in Brazil the time zones are -3h and -4h you will always see more hours than your current one.
Unfortunately there is no real way to fix this display withinMongoDB
:(, but if you think otherwise this is also good as this means that you can have many applications in different time zones and all of them can work from a fixed date (UTC).