I have an input text with id CldrFrom
It has date like this: 04/17/2014
in other words mm/dd/yyyy
I want to change it to this format 17-04-2014
in other words dd-mm-yyyy
I want to do that in jQuery.
What I have tried
var currentDate = $(#CldrFrom").val();
val = val.replace("/", "-");
So I replaced the /
with -
but I still need to make the day as the first not the month.
how please?
Edit
to take the date I am using a datepicker library. I call it like this:
$("#CldrFrom, #CldrTo").datepicker();
is there anyway so directly I make that library prints dates in this format dd-mm-yyyy
?