Using moment.js to convert date to string “MM/dd/yyyy”

后端 未结 6 1662
有刺的猬
有刺的猬 2021-01-31 06:55

I need to take the date value from jquery datepicker turn it into string format \"MM/dd/yyyy\" so it can do the right ajax post. When the page loads or upon changing the datepic

6条回答
  •  遥遥无期
    2021-01-31 07:22

    StartDate = moment(StartDate).format('MM-YYYY');
    

    ...and MySQL date format:

    StartDate = moment(StartDate).format('YYYY-MM-DD');
    

提交回复
热议问题