I can't parse the simplest date string for some reason. the following is giving me 'invalid date'.
moment.locale('en-gb');
var tempDate = moment("23/07/2018").format("DD/MM/YYYY");
this doesn't work either:
moment.locale('en-gb');
var tempDate = moment("23/07/2018");
您可以使用moment
函数的String + Format版本:
moment("23/07/2018", "DD/MM/YYYY")
var mydate= moment("23/07/2018","DD/MM/YYYY").format("DD/MM/YYYY"); console.log(mydate);
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.