how to convert particular time into UTC timestamp
This question already has an answer here:
You can just create UTC Timestamps with the full date. You can use the .getTime() function of the Date object. You will get the milliseconds since 1970/01/01 and then divide it with 1000 to get the seconds.
let datestring = "2017-10-21 13:22:01";
let date = new Date(datestring);
console.log(date.getTime() / 1000); // will return 1508584921
You can also take a look at Moment.js which is great for handling Date and Time in Javascript.
EDIT: If you want todays date 22:00:00 just init new Date and set the time like this:
let date = new Date();
date.setHours(22);
date.setMinutes(0);
date.setSeconds(0);
链接地址: http://www.djcxy.com/p/13568.html
下一篇: 如何将特定时间转换为UTC时间戳