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;
}
So, in order to ensure compatibility in various browsers, in fact, in order to be compatible with IE, we are using Date() It is best to use them uniformly
new Date(year, month, day, hour, minute, sec, millsec)
or
new Date(millsec) (millsec is the number of milliseconds since January 1, 1970).
The result returned when new Date (""date text"") is run in IE is a special date object, but the IE debugger displays it as NaN, and calling the method that returns number will return NaN
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