且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Moment.js从日期获取日期名称

更新时间:2023-01-31 16:14:54

现在,您可以解析日期字符串:

With moment you can parse the date string you have:

var dt = moment(myDate.date, "YYYY-MM-DD HH:mm:ss")

这是UTC,如果需要,您必须从该点转换时区.

That's for UTC, you'll have to convert the time zone from that point if you so desire.

然后您可以获得星期几:

Then you can get the day of the week:

dt.format('dddd');