Moment.js get day name from date
With moment you can parse the date string you have:
var dt = moment(myDate.date, "YYYY-MM-DD HH:mm:ss")
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');
code
var mydate = "2017-06-28T00:00:00";var weekDayName = moment(mydate).format('dddd');console.log(weekDayName);
mydate is the input date. The variable weekDayName get the name of the day.Here the output is
Output
Wednesday
var mydate = "2017-08-30T00:00:00";console.log(moment(mydate).format('dddd'));console.log(moment(mydate).format('ddd'));console.log('Day in number[0,1,2,3,4,5,6]: '+moment(mydate).format('d'));console.log(moment(mydate).format('MMM'));console.log(moment(mydate).format('MMMM'));
<script src="https://momentjs.com/downloads/moment.js"></script>
var mydate = "2017-06-28T00:00:00";var weekDayName = moment(mydate).format('ddd');console.log(weekDayName);
Result: Wed
var mydate = "2017-06-28T00:00:00";var weekDayName = moment(mydate).format('dddd');console.log(weekDayName);
Result: Wednesday