How to deal with js date object compatibility_javascript skills
May 16, 2016 pm 05:02 PMfunction 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

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Comparison and difference analysis of Bluetooth 5.3 and 5.2 versions

Solution to i7-7700 unable to upgrade to Windows 11

Recommended: Excellent JS open source face detection and recognition project

How compatible is the Go language on Linux systems?

Can I use Bluetooth headphones in airplane mode?

WIN10 compatibility lost, steps to recover it

Detailed explanation of win11 compatibility issues with win10 software

Introducing the driver download method for win10 to ensure compatibility
