JavaScript - Parse UTC Date
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How can I parse a simple date string and let JavaScript know that it's actually a UTC date? Currently, if I do new Date('2015-08-27') it converts it to my timezone. 回答1: You can do append 'T00:00:00.000Z' to make the time zone specific (Z indicates UTC) new Date('2015-08-27' + 'T00:00:00.000Z') Note that new Date('2015-08-27') is treated differently in ES5 (UTC) vs. ES6 (Local), so you can't expect it any correction to be work consistently if you were planning to to hard code it (i.e. don't do it) Also, do note that your console.log might