EJo EJo - 3 months ago 4x
jQuery Question

Inbuild Functionality to Format Dates using Jquery

I have a requirement to show a date in the format as below in the label control.

Wednesday 20 Jul 2016 11:31 AM

Is there any in build functionality available with Jquery without righting my on function to build the string in the specific way as above?


You can use date.format library:

var dateFormat = require('dateformat');
var now = new Date();
dateFormat(now, "dddd dS mmmm yyyy h:MM TT");

It will return

Wednesday 20 Jul 2016 11:31 AM