Convert dd-mm-yyyy string to date

后端 未结 14 2152
孤城傲影
孤城傲影 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:05

    new Date().toLocaleDateString();
    

    simple as that, just pass your date to js Date Object

提交回复
热议问题