Lara Ch Lara Ch - 10 months ago 49
Javascript Question

Using jQuery to change date format into d-m-y

I need to change a date format taken from HTML date input and added into a text box. Currently if I am adding date as: 04-26-2016 it will be added to text box as 2016-04-26.

But what I need is to add it into my text box as : 26-04-2016.
Is their any way using jquery ?

//onee is date input:
$("#onee").on('change', function()
var val = $("#onee").val();
$('#one').val($('#one').val() + "- Date:" + val);


Set a's value to your textbox.

var a=$.datepicker.formatDate( "dd-mm-yy", new Date("2016-04-26"));


Output: "26-04-2016"