Trying to retrieve the month and year from a customized date string Wed Dec 24 00:00:00 -0800 2014
with Moment.js.
Came across this previous solution: How to parse given date string using moment.js? however, the accepted answer is causing an error.
Expected the syntax to be:
var date = moment("Wed Dec 24 00:00:00 -0800 2014", "ddd MMM DD HH:MM:SS ZZ YYYY").format('dd');
console.log(date);
anticipated output is 24
but instead receiving Invalid Date
.
Any suggestions on how to extract the date from the provided date string? Thank you.