admin管理员组文章数量:1309921
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");
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");
Share
Improve this question
asked Jul 13, 2018 at 10:20
BMillsBMills
9012 gold badges10 silver badges27 bronze badges
2 Answers
Reset to default 7You can use String+Format version of the moment
function:
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./ajax/libs/moment.js/2.22.2/moment.min.js"></script>
本文标签: javascriptParsing datestring in format quotddmmyyyyquot in momentjsStack Overflow
版权声明:本文标题:javascript - Parsing datestring in format "ddmmyyyy" in moment.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741807110a2398570.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论