且构网

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

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

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

现在你可以解析你拥有的日期字符串:

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');