Nwakego
Nwakego

Reputation: 38

Changing the format of the UI date picker

I am using the UI datepicker and I have already limited the date range possible, bt now, I also want to change the format becuase my mysql database is not storing the dates as the format is not the ISO format(yyyy-mm-dd), it is more like(dd-mm-yy), here is my code please! :

<script type="text/javascript">
$(function() {
        $("#datepicker").datepicker({minDate: +7, maxDate: '+4M +10D'});
    });
</script>

Upvotes: 0

Views: 361

Answers (4)

Mikel
Mikel

Reputation: 1

Well in do in the version for MooTools editing the .js script:

  // MooTools.lang
  this.setOptions({
   days: MooTools.lang.get('Date', 'days'),
   months: MooTools.lang.get('Date', 'months'),
   //format: MooTools.lang.get('Date', 'shortDate'),
   format: '%d-%m-%Y',
   selectTimeTitle : MooTools.lang.get('DatePicker', 'select_a_time'),
   timeConfirmButton : MooTools.lang.get('DatePicker', 'time_confirm_button')
  });

Upvotes: 0

Bobby
Bobby

Reputation: 11576

Please have a look the site:

$('#datepicker').datepicker('option', {dateFormat: 'yyyy-mm-dd'});

Upvotes: 1

Nwakego
Nwakego

Reputation: 38

thank you guys, but what worked for min the end was changing the format in the ui datepicker.js script, it was that simple. thank you for anwering though

Upvotes: 0

S Philp
S Philp

Reputation: 452

Check - http://docs.jquery.com/UI/Datepicker/$.datepicker.formatDate

Easy as replace dd/mm/yy with format of choice :)

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

Upvotes: 2

Related Questions