Convert dd-mm-yyyy string to date

后端 未结 14 2171
孤城傲影
孤城傲影 2020-11-22 05:09

i am trying to convert a string in the format dd-mm-yyyy into a date object in JavaScript using the following:

 var from = $(\"#datepicker\").val();
 var to          


        
14条回答
  •  无人共我
    2020-11-22 06:04

    You can use an external library to help you out.

    http://www.mattkruse.com/javascript/date/source.html

    getDateFromFormat(val,format);
    

    Also see this: Parse DateTime string in JavaScript

提交回复
热议问题