码迷,mamicode.com
首页 > 编程语言 > 详细

javascript下ie7,ie8的Date Bug的解决

时间:2015-11-25 13:09:44      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:

[一篮饭特稀原创,转载请注明出自http://www.cnblogs.com/wanghafan/p/4994200.html
1
function parseISO8601(dateStringInRange) { 2 var isoExp = /^\s*(\d{4})-(\d\d)-(\d\d)\s*$/, 3 date = new Date(NaN), month, 4 parts = isoExp.exec(dateStringInRange); 5 6 if(parts) { 7 month = +parts[2]; 8 date.setFullYear(parts[1], month - 1, parts[3]); 9 if(month != date.getMonth() + 1) { 10 date.setTime(NaN); 11 } 12 } 13 return date; 14 }

ajax后台返回格式为"XXXX-XX-XXTXX:XX:XX"

调用方式:var BeginTime = new Date(parseISO8601(m_ProjectTEN.BeginTime.split(‘T‘)[0]));

 

javascript下ie7,ie8的Date Bug的解决

标签:

原文地址:http://www.cnblogs.com/wanghafan/p/4994200.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!