How to change the data timezone in mongodb atlas

Yeah I think it’s fair to say that.

I’m in Paris right now so my current TZ is UTC+2. It’s currently 15:51 local time in Paris. But if I create a new date in MongoDB, it’s going to be 13:51 UTC+2.

test [direct: primary] test> db.coll.insertOne({date: new Date()})
{
  acknowledged: true,
  insertedId: ObjectId("62a9e3e50c008ec5fa9c6caf")
}
test [direct: primary] test> db.coll.findOne()
{
  _id: ObjectId("62a9e3e50c008ec5fa9c6caf"),
  date: ISODate("2022-06-15T13:51:33.388Z")
}

Take a look at this topic as well. This might help.

Cheers,
Maxime.

2 Likes