I have date like this Wed Apr 26 2017 12:20:14 GMT+0530 (India Standard Time), I need to format this date as below format in javascript,
April 26, 2017 12:20 PM
please help on this. Thanks
I have date like this Wed Apr 26 2017 12:20:14 GMT+0530 (India Standard Time), I need to format this date as below format in javascript,
April 26, 2017 12:20 PM
please help on this. Thanks
You could do this with moment library simply by:
var moment = require('moment')
var date = new Date('Wed Apr 26 2017 12:20:14 GMT+0530')
moment(date).format('LLL')
let
date = new Date(Date.UTC(2017, 3, 26, 12, 20, 14)),
options = {
year: "numeric",
month: "short",
day: "numeric",
hour: "2-digit",
minute: "2-digit"
};
date.toLocaleTimeString("en-us", options);