Perfect solution IE does not support data.parse () Problem _javascript skills

Source: Internet
Author: User

IE can not recognize the JS function Date.parse solution, when we use JS to calculate the interval of two time, we will use the Date.parse this JS function.

Such as:

var begintime = "2012-12-22"; Start Time  
var endtime = "2012-12-25";  End Time  
var begindate=new date (begintime);  
var enddate=new date (endtime);  
var days = Date.parse (enddate)- Date.parse (begindate); Calculate Two time difference  

When we are in IE, alert is not a number, but alert out NAV, while in Firefox, Alert 3

Function Delimiterconvert (val) {//Format speech Data return  
  val.replace ('-', '/'). Replace ('-', '/')  

The above is small series for everyone to bring the perfect solution IE does not support data.parse () all the content of the problem, I hope that we support cloud Habitat Community ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.