0

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

2 Answers2

0

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

https://repl.it/H3oL/0

KornholioBeavis
  • 1,956
  • 1
  • 14
  • 24
0
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);

repl.it

Maciej Caputa
  • 1,651
  • 10
  • 15