I'm having troubles on formating the dates on Jquery UI datapicker.
What I have to do is choose a date on the calendar UI and then I have to calculate some dates based on the date entered. Everything is working except for the date format. Is showing me the FULL date as follows: "Mon Sep 15 2014 00:00:00 GMT+0200 (Hora de verano romance)" and I just want a dd-mm-yy format
check it here http://fiddle.jshell.net/80em5wLd/
<input type="text" name="arrivalDate" class="datepicker">
<input type="" name="auditDate" value="">
<input type="" name="presentationDate" value="">
$('input[name="arrivalDate"]').datepicker({
onSelect: function(){
var start = $('input[name="arrivalDate"]').val();
var audit= 14;
var presentation= audit+14;
var date = new Date(start);
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var date_1= new Date (y, m, d+audit);
var date_2= new Date(y, m, d+presentation);
$('input[name="auditDate"]').val(date_1);
$('input[name="presentationDate"]').val(date_2);
}
});
Thanks!
Have this a try, date.toLocaleDateString();