I have a variable which stores the date as "18/07/2013". I need to parse this to "07/18/2013". How this is possible in jquery?
var date = $("#dte").val();
I have a variable which stores the date as "18/07/2013". I need to parse this to "07/18/2013". How this is possible in jquery?
var date = $("#dte").val();
javascript's Date accepts a string in the format year / month / day, so just reverse the order and create a date object :
var date = '18/07/2013';
var dObj = new Date(date.split('/').reverse().join('/'));
var newD = dObj.getDate() + '/' + (dObj.getMonth()+1) + '/' + dObj.getFullYear();