I have a moment date object, and want to get the selected day number (0-6) or (1-7).
I tried this, but it doesn't work
var aaa= moment(date).day();
help me with this please
I have a moment date object, and want to get the selected day number (0-6) or (1-7).
I tried this, but it doesn't work
var aaa= moment(date).day();
help me with this please
I think this would work
If you are specifically looking for the 1-7 approach...
This is the ISO weekday number. moment.js has also taken this into account. Use
isoWeekday()
Seeing as I wrote this answer on a Tuesday, today this gives me a 2.
From the docs page, notice they have these helpful headers
http://momentjs.com/docs/#/get-set/weekday/
(I didn't see them at first)
With header sections for:
.
Define "doesn't work".
This prints "4", as expected.