var date1=new Date(dateTimes[z][1]);
The time can be obtained normally under Firefox, but it is NaN under IE7. After struggling for a long time, I gave up on new date and then found a piece of code in a foreigner's forum that could be compatible with the formatted date code of all browsers:
function NewDate(str) {
str = str.split('-');
var date = new Date();
date.setUTCFulYear(str[0], str[1] - 1, str[2]);
date.setUTCHours(0, 0, 0, 0);
return date;
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn