Home Web Front-end JS Tutorial Solution to the problem that ie8 does not support new Date (2012-11-10)_javascript skills

Solution to the problem that ie8 does not support new Date (2012-11-10)_javascript skills

May 16, 2016 pm 05:27 PM
date ie8 new

We also encountered such a problem when using JS. Later, after modification, the following code is available in the IE8 environment.

js end time-start time, get the number of days

Copy code The code is as follows:

function getDays(strDateStart,strDateEnd){
var strSeparator = "-"; //Date separator
var oDate1;
var oDate2;
var iDays;
oDate1= strDateStart .split(strSeparator);
oDate2= strDateEnd.split(strSeparator);
var strDateS = new Date(oDate1[0], oDate1[1]-1, oDate1[2]);
var strDateE = new Date(oDate2[0], oDate2[1]-1, oDate2[2]);
iDays = parseInt(Math.abs(strDateS - strDateE ) / 1000 / 60 / 60 /24)//Difference Convert milliseconds to days
return iDays ;
}
Statement of this Website
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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to create and name a file/folder based on current timestamp How to create and name a file/folder based on current timestamp Apr 27, 2023 pm 11:07 PM

How to create and name a file/folder based on current timestamp

PHP Warning: date() expects parameter 2 to be long, string given solution PHP Warning: date() expects parameter 2 to be long, string given solution Jun 22, 2023 pm 08:03 PM

PHP Warning: date() expects parameter 2 to be long, string given solution

Introduction to methods and usage of using Date and SimpleDateFormat classes to process time in Java Introduction to methods and usage of using Date and SimpleDateFormat classes to process time in Java Apr 21, 2023 pm 03:01 PM

Introduction to methods and usage of using Date and SimpleDateFormat classes to process time in Java

What are the options for calendar and date libraries in Python? What are the options for calendar and date libraries in Python? Oct 21, 2023 am 09:22 AM

What are the options for calendar and date libraries in Python?

How to get the millisecond representation of a date using the getTime() method of the Date class How to get the millisecond representation of a date using the getTime() method of the Date class Jul 24, 2023 am 11:42 AM

How to get the millisecond representation of a date using the getTime() method of the Date class

How to solve the problem of springboot configuring date field to return timestamp How to solve the problem of springboot configuring date field to return timestamp May 20, 2023 am 11:16 AM

How to solve the problem of springboot configuring date field to return timestamp

How to solve the incompatibility prompt of vue ie8 How to solve the incompatibility prompt of vue ie8 Jan 29, 2023 am 10:20 AM

How to solve the incompatibility prompt of vue ie8

How to use Stringbuild, Date and Calendar classes in Java How to use Stringbuild, Date and Calendar classes in Java May 22, 2023 pm 04:52 PM

How to use Stringbuild, Date and Calendar classes in Java

See all articles