I am using jQuery datepicker, and I am displaying my date in
dd-mm-yyyy
format but I need to send date in
yyyy-mm-dd
format to store in database.
$(document).ready(function(){
$('.datepicker').datepicker({
format : 'dd-mm-yyyy',
maxDate : new Date(),
selectMonths : true,
selectYears: d,
yearRange: 100 ,
});
});
the above code will show date format
dd-mm-yy
and when I submit the form using ajax, it sends using this same format. I need to change the submit format to
yyyy-mm-dd
Check this fiddle.
string, rather than of typedate, then you will save yourself a lot of pain if you just migrate the column to thedatetype. However, we realise this might not be possible, if someone else in in charge of the database schema, if the system is already in place, or if the DB is accessed through a stringly-typed protocol. (@musefan) - user234461