Home  /  Questions  /  Question

129   96.7
Jul 19, 2011

Change date format with jQuery UI DatePicker

I have an inline datepicker using jQuery UI, like so:

<div id="datepicker"></div>
I then retrieve the date in Javascript:
// retrieve date
var dt = $('#datepicker').val());
The result is a date: for example:  7/19/11, but I need to redisplay it in this format: d MM, yyyy.
Is there no way to specify a format mask when retrieving the date from DatePicker?


1,364   100.0
Jul 23, 2011
Try this code...

// Change the format as required...
var dt =  $('#datepicker').datepicker({ dateFormat: 'd-MM-yyyy' });