SoFunction
Updated on 2025-04-09

How to deal with new Date problem under ie8

How to deal with new Date() problem under ie8

Updated: July 31, 2014 09:10:57 Submission: whsnow
This section mainly introduces the problem of handling new Date() below ie8. Friends who need it can refer to it
<script> 
function getDays(strDateStart,strDateEnd){ 
  var strSeparator = "-";  
  var oDate1; var oDate2; var iDays; 
  oDate1= (strSeparator); 
  oDate2= (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((strDateS - strDateE ) / (1000*24*3600)) 
  return iDays ; 
}  
alert(getDays('2014-02-26','2014-08-18')) 
</script>
  • ie8
  • Date

Related Articles

  • The entire process of implementing immersive navigation of uni-app applets

    In cross-end project development, uniapp is a good framework. The following article mainly introduces relevant information about the implementation of immersive navigation of uni-app applets. The article introduces the example code in detail. Friends who need it can refer to it.
    2022-10-10
  • The three most commonly used JS time effects

    This article mainly introduces the three most commonly used JS time effects. It is recommended to everyone. Friends in need can refer to it.
    2015-08-08
  • JavaScript Design Pattern – Adapter Pattern Principle and Application Example Analysis

    This article mainly introduces the JavaScript design pattern - adapter pattern, and analyzes the concepts, principles, usage and operation precautions related to the JavaScript adapter pattern in combination with the example form. Friends who need it can refer to it.
    2020-04-04
  • Talk about understanding of offsetleft compatibility

    The offsetleft attribute has certain compatibility problems. In the IE7 browser, its return value is relative to the distance to the left of the nearest parent class element. This article introduces the offsetleft compatibility problems to you through code examples. Let’s take a look.
    2015-11-11
  • Using the simplest bar chart example code to implement

    It is a JavaScript library based on data manipulation documentation. D3 helps you bring vitality to your data through the use of HTML, SVG and CSS. D3 values ​​the web standard to provide you with all the functionality of a modern browser, rather than giving you a proprietary framework. Recently I was studying this example by drawing a simple bar chart. Let’s take a look together below.
    2016-12-12
  • JS implements table sorting with interlaced colors

    This article mainly introduces the relevant knowledge of JS to implement interlaced table sorting. It has good reference value. Let's take a look with the editor below
    2017-03-03
  • A brief analysis of the conversion of JavaScript Array and string (recommended)

    The following editor will give you a brief analysisJavaScript ArrayandstringConversion(recommend)。 The editor thinks it is quite good, so I will share it with you now and give you a reference. Let's take a look with the editor
    2016-05-05
  • Simple instance of javascript showing user stay time

    This article introduces a simple example of javascript showing user residence time. Friends who need it can refer to it.
    2013-08-08
  • js get the time code for the occurrence and termination of daylight saving time in the current time zone

    This article mainly introduces the time code for js to obtain the current time zone daylight saving time. Friends who need it can refer to it
    2014-02-02
  • Summary of common methods for array (Array) objects and string (String) objects in javascript

    This article mainly introduces the common methods of array (Array) objects and string (String) objects in JavaScript. Combined with the example form, we summarize and analyze the common functions and usage techniques for arrays and strings in JavaScript. Friends who need it can refer to it.
    2016-12-12

Latest Comments