美文网首页
IE 下 字符串转日期

IE 下 字符串转日期

作者: yisky | 来源:发表于2016-12-19 14:12 被阅读6次

    需求 "startTime": "2016-11-21 11:43:20",转成 "2016-11-21"

    原操作:
    IE下会报错.

    (new Date(taskinfoObj.startTime)).pattern("yyyy-MM-dd HH:mm:ss");
    

    改良后:

    (new Date(taskinfoObj.startTime.replace(/-/g, "/"))).pattern("yyyy-MM-dd HH:mm:ss");
    

    相关文章

      网友评论

          本文标题:IE 下 字符串转日期

          本文链接:https://www.haomeiwen.com/subject/xnrtvttx.html