I’m trying to save a Date value from nodejs in my mongodb, but the saved value is one day earlier. More exactly its one hour.
If I use console.log(new Date(this.year, this.month, this.day)); in nodejs I get:
Tue Mar 19 2013 00:00:00 GMT+0100 (CET)
but in mongodb I have following record:
2013-03-18 23:00:00 +0000
the record is one hour earlier.
But why? Have I to set the timezone in mongodb? I’m using Os X with:
Time Zone: Europe/Berlin
To avoid the timezone problem, just add
process.env.TZ = 'UTC'in the"main".