Node.js momentjs不返回正确的日期格式
我指的是nodejs的momentjs库,我的代码如下所示Node.js momentjs不返回正确的日期格式,node.js,date,datetime,momentjs,Node.js,Date,Datetime,Momentjs,我指的是nodejs的momentjs库,我的代码如下所示 console.log("For date:" + item.DueDate + " the format is:" + moment(item.DueDate).format("do, MMM")) 上面的输出是 For UTC date:2020-07-28T00:00:00.000+0000 the format is:2nd, Jul 我不明白为什么7月28日被
console.log("For date:" + item.DueDate + " the format is:" + moment(item.DueDate).format("do, MMM"))
上面的输出是
For UTC date:2020-07-28T00:00:00.000+0000 the format is:2nd, Jul
我不明白为什么7月28日被印成7月2日
我也尝试过:
moment(item.DueDate).utc().format("do, MMM")
但结果相同。您使用的是
do
(带序号的周日)而不是do
(带序号的月日)
引述:
第12个月的第1天。。。30 31
做第一个第二个。。。让我检查一下这个。