July 18, 2015

How to change date format (MM/DD/YY) to (YYYY-MM-DD) in date picker?

Use the dateFormat function for that:

Example:
$(function(){
$("#to").datepicker({ dateFormat: 'yy-mm-dd' });
$("#from").datepicker({ dateFormat: 'yy-mm-dd' }).bind("change",function(){
var minValue = $(this).val();
minValue = $.datepicker.parseDate("yy-mm-dd", minValue);
minValue.setDate(minValue.getDate()+1);
$("#to").datepicker( "option", "minDate", minValue );
})
});


Demo : http://jsfiddle.net/gaby/WArtA/

Enjoy!

No comments:

Post a Comment

The Future of Technology: Emerging Trends to Watch in 2025

Introduction As we navigate through 2025, the technological landscape continues to evolve at an unprecedented pace. Innovations that once se...