momentjs docs

JavaScript
moment(testDate).format('MM/DD/YYYY');var time = "15:30:00";
var formatted = moment(time, "HH:mm:ss").format("LT");
console.log(formatted); 
//it will return 3:30 PMnpm install moment
var moment = require('moment'); // require
moment().format(); 

Source

Also in JavaScript: