javascript - Formatting time using moment JS shows incorrect Date - Stack Overflow

I have time ing from server in certain format for example time is (1473286826319). Using MomentJS libra

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?

Share Improve this question edited Sep 8, 2016 at 2:38 user663031 asked Sep 7, 2016 at 23:38 Raghu ChaitanyaRaghu Chaitanya 1511 gold badge2 silver badges9 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

You 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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745276072a4620049.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信