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>
Check - http://docs.jquery.com/UI/Datepicker/$.datepicker.formatDate
Easy as replace dd/mm/yy with format of choice :)
.datepicker({ dateFormat: 'dd/mm/yy' });
Please have a look the site:
$('#datepicker').datepicker('option', {dateFormat: 'yyyy-mm-dd'});
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
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')
});
精彩评论