Parse 'Date & Time' string in Javascript which are of custom format

前端 未结 5 1131
-上瘾入骨i
-上瘾入骨i 2020-11-30 10:08

I have to parse a date and time string of format \"2015-01-16 22:15:00\". I want to parse this into JavaScript Date Object. Any help on this?

I tried some jquery plu

5条回答
  •  情深已故
    2020-11-30 10:36

    A better solution, I am now using date.js - https://code.google.com/p/datejs/

    I included the script in my html page as this -

    
    

    Then I simply parsed the date string "2015-01-16 22:15:00" with specifying the format as,

    var dateString = "2015-01-16 22:15:00";
    var date = Date.parse(dateString, "yyyy-MM-dd HH:mm:ss");
    

提交回复
热议问题