How to Change Date Format for JQuery Datepicker?

Updated on     Kisan Patel

Problem:

How to change date format for jQuery UI datepicker?
How to set date format as ‘dd-mm-yyyy’ in jQuery datepicker?

Solution:

By Setting “dateFormat” option allows you to set the format of selected dates using a variety of short-hand references.

$('#myVariable').datepicker({
      dateFormat: 'dd-mm-yy'
});

Tryit Yourself

The format of dates can be a combination of any of the following characters:

d day of month (single digit where applicable)
dd day of month (two digits)
m month of year (single digit where applicable)
mm month of year (two digits)
y year (two digits)
yy year (four digits)
D short day name
DD full day name
M short month name
MM long month name

jQuery

Leave a Reply