2

I am invoking the datepicker on an input box. However, irrespective of the format I am giving, it always returns the date in mm/dd/yyyy format. I want it to return - 30-11-2011 (dd-mm-yyyy) format. Below are the options I tried -

Option 1

$("#birthdate").datepicker({
    changeYear: true,
    changeMonth: true
    dateFormat: 'yy-mm-dd'
    });

Option 2

$.datepicker.formatDate('yy-mm-dd', new Date(2007, 1 - 1, 26));

My html includes jquery-ui.js, jquery-ui-datepicker.js and jquery.js.

I have already referred to jQuery UI DatePicker - Change Date Format and Jquery datepicker format date not working and tried all the option but none of them in working for me. Please let me know if someone knows the solution.

Community
  • 1
  • 1
adhiran
  • 51
  • 1
  • 6
  • 1
    Option 1) is missing a comma. Have you tried: $("#birthdate").datepicker({ changeYear: true, changeMonth: true, dateFormat: 'yy-mm-dd' }); – Felix Oct 10 '12 at 21:35
  • comma is somehow missed while pasting the code, but it doesn't work with comma as well. – adhiran Oct 10 '12 at 21:45
  • You are loading jquery-ui AND jquery-ui-datepicker? I use this widget a lot and have not had trouble with date formatting. It's possible that including both of these files is what is at fault? – BLSully Oct 10 '12 at 21:51
  • wow ! removing jquery-ui.js worked. Thank you so much ! – adhiran Oct 10 '12 at 22:08
  • @adhiran: I posted my answer you indicated was the solution to your problem. Please mark this question answered. Thanks! – BLSully Oct 12 '12 at 18:45

0 Answers0