Problem: Different countries, the use of different time zones, and server code in the country, across time zone date, based on the date query, no data query
The 1.mongodb stored new date () is the UTC time, which is the time of the 0 time zone, world standard Time
2. Refer to Moment official website, time zone problem: http://momentjs.com/timezone/docs/
npm install moment-timezone
var moment = require (' Moment-timezone ');
Console.log (Moment (' 2018-08-17t07:46:37.000+08:00 '). TZ ("Asia/tokyo"). Format (' Yyyy/mm/dd HH:mm:ss '))//asia/tokyo , Asia/hong_kong,america/new_york,asia/shanghai
Console.log (' Shanghai: ' +moment (). TZ ("Asia/shanghai"). Format (' Yyyy/mm/dd HH:mm:ss ')
Console.log (' Hong Kong: ' +moment (). TZ ("Asia/shanghai"). Format (' Yyyy/mm/dd HH:mm:ss ')
Console.log (' Japan: ' +moment (). TZ ("Asia/tokyo"). Format (' Yyyy/mm/dd HH:mm:ss ')
Console.log (' New York: ' +moment (). TZ ("America/new_york"). Format (' Yyyy/mm/dd HH:mm:ss ')
For more supported time zones, please refer to Moment-timezone source Moment-timezone/builds/moment-timezone-with-data-2012-2022.js
Nodejs,mongodb different time zone issues