The problem is this. The company wants to make an online video tutorial, which requires students to make an appointment and the teacher to get the time to start the class. However, because it is international, the time in each time zone is different, so the front end needs to convert the time into UTC time. Send it to the backend, and then convert the UTC time into local time when getting the data. Please help, how can js realize the conversion between local time and UTC time
黄舟2017-05-19 10:28:57
new Date().toISOString();
At the same time, the Date object also accepts parameters to convert the corresponding parameters into utc
迷茫2017-05-19 10:28:57
var localDateTime = new Date();
var utcDateTime = localDateTime.toISOString();
console.log(utcDateTime); //"2017-04-27T17:56:34.601Z"
var utcDateTimeStr = "2017-04-27T17:56:34.601Z";
var localDateTime = new Date(utcDateTimeStr); // 使用Date构造函数获得本地时间对象