Monday, 24 April 2017

NodeJs new Date() has wrong time

root@ubuntu:/firma/Exotech/heart-beat/heart-beat-service# date
Mon Apr 24 17:07:52 CEST 2017
root@ubuntu:/firma/Exotech/heart-beat/heart-beat-service# node test.js
2017-04-24T15:07:56.271Z
root@ubuntu:/firma/Exotech/heart-beat/heart-beat-service# cat test.js
console.log(new Date())
root@ubuntu:/firma/Exotech/heart-beat/heart-beat-service#

As you can see, the server date 17:07, but the new Date() is returning 15:07. How to correct my Nodejs with the server's date settings?



via user2386092

No comments:

Post a Comment