阅读962 返回首页    go 阿里云 go 技术社区[云栖]


Date.parse Firefox返回Nan的解决办法

不知何故,firefox对于类似“2010-12-20 15:55:00”这种时间的转换格式不感冒,返回Nan,查了查资料,把“-”替换为“/”就可以了;

 

<mce:script type="text/javascript"><!-- var inputDate="2010-12-20 15:55:00"; inputDate=inputDate.replace("-", "/").replace("-", "/"); var nowDate=new Date(); //alert(Date.parse(inputDate)) //alert(Date.parse(nowDate)) if(Date.parse(inputDate)<Date.parse(nowDate)) { alert("对不起,输入时间不能晚于当前时间!"); } // --></mce:script>  

最后更新:2017-04-02 06:51:33

  上一篇:go Jquery实现页面定时跳转
  下一篇:go 程序员VS.艺术家