JS uses new date (str) To create time objects incompatible with Firefox and IE solutions

Source: Internet
Author: User

/** * fix IE, Firefox is incompatible with new date (s) * @param strdate * Return Date Object * Add by ZYF at November 5, 2015*/functiongetdateforstringdate (strdate) {//the date and time of the cut are called arrays .    vars = Strdate.split (""); varS1 = S[0].split ("-"); varS2 = S[1].split (":"); if(s2.length==2) {S2.push ("00"); }    return NewDate (s1[0],s1[1]-1,s1[2],s2[0],s2[1],s2[2]);}

The other constructor is also compatible with the more strong to stick it out

var New Date (Strdate.replace ("-", "/"). Replace ("-", "/"));

JS uses new date (str) To create time objects incompatible with Firefox and IE solutions

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.