Date issue in Firefox

后端 未结 4 1323
遥遥无期
遥遥无期 2021-01-06 09:06

I want to parse date in my page to Javascript\'s Date.

So I have this in my page

01-07-2012 01:04 PM

4条回答
  •  南笙
    南笙 (楼主)
    2021-01-06 09:16

    try this:

    var tagText = $(this).html();
    tagText = tagText.replace(/-/g, '/');
    var givenDate = new Date(tagText);
    alert(givenDate);
    

提交回复
热议问题