admin管理员组文章数量:1417691
I have time ing from server in certain format for example time is (1473286826319)
. Using MomentJS library
moment(1473286826319).format()
// output 2016-09-07T16:20:26-06:00 i.e sep 7 2016
However when I use custom formating style as below
moment(1473286826319).format('dddd, MMMM d, YYYY, h:mm A');
// output Wednesday, September 3, 2016, 4:20 PM
I have the date going back from Sept 7
to Sept 3
and rest of the data is accurate. Is there something I am doing wrong?
I have time ing from server in certain format for example time is (1473286826319)
. Using MomentJS library
moment(1473286826319).format()
// output 2016-09-07T16:20:26-06:00 i.e sep 7 2016
However when I use custom formating style as below
moment(1473286826319).format('dddd, MMMM d, YYYY, h:mm A');
// output Wednesday, September 3, 2016, 4:20 PM
I have the date going back from Sept 7
to Sept 3
and rest of the data is accurate. Is there something I am doing wrong?
1 Answer
Reset to default 9You are using a small d
which is the Day of Week. If you want the Day of Month use a D
or a DD
for leading zeros.
Checkout the documentation
本文标签: javascriptFormatting time using moment JS shows incorrect DateStack Overflow
版权声明:本文标题:javascript - Formatting time using moment JS shows incorrect Date - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745276072a2651194.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论