Jquery date selector jquery in uk format

I use the jQuery datepicker from the website so that users can select a date and wondered if the displayed date can be displayed in the UK format, for example, September 22, 2012, in the UK like 09/22/2012, while in the American format its 09/22/2012

+6
source share
3 answers

try the following:

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

 $.datepicker.formatDate( format, date, settings ) 

Format the date to a string value with the specified format.

The format may be a combination of the following:

 d - day of month (no leading zero) dd - day of month (two digit) o - day of the year (no leading zeros) oo - day of the year (three digit) D - day name short DD - day name long m - month of year (no leading zero) mm - month of year (two digit) M - month name short MM - month name long y - year (two digit) yy - year (four digit) @ - Unix timestamp (ms since 01/01/1970) ! - Windows ticks (100ns since 01/01/0001) '...' - literal text '' - single quote anything else - literal text 
+19
source

Use one of the following

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

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

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

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

+3
source

As ebram tharwat answer :

I changed: $('#datepicker').datepicker({ dateFormat: 'dd-mm-yy' }); up to $('#datepicker').datepicker({ format: 'dd-mm-yy' }); and it worked for me

0
source

All Articles