convert a time string say '12:05 PM' into a datetime using Date.Parse in javascript

后端 未结 4 1193
说谎
说谎 2021-01-15 03:33

I want to convert a time string say \'12:05 PM\' into a datetime using Date.Parse in javascript. When I pass in a value of say 12:05 PM or 12:10 PM or ... or 12:55 PM the va

4条回答
  •  滥情空心
    2021-01-15 04:22

    If you're using date.js then try (as per test case here)

    Date.parseExact("12:05 PM", "hh:mm tt");
    

    This should also pick up if you've loaded the library correctly.

提交回复
热议问题