Monday, 12 November 2018

NodeJS: Why is there a two hour difference in new Date()?

I am doing a

console.log(process.env.TZ);
console.log(new Date());

It outputs

Europe/Amsterdam
2018-09-02T08:07:03.842Z

But the current time is 10:07 not 08:07.

The problem is is that I am receiving date time strings from an api and storing it in my db, but the times are not stored properly. I am using Loopback (NodeJS) with a MySQL connector to do this.

so the problem is that when I save it, it somehow gets converted to UTC which is not what I want. Its like order.delivery_date = 2018-08-06 10:00:00; order.save(). when I look in the db, it says 08:00:00. How do I prevent this from happening?



from NodeJS: Why is there a two hour difference in new Date()?

No comments:

Post a Comment