Change Date format MM/DD/YYYY to DD/MM/YYYY in Javascript function







Change Date format    MM/DD/YYYY  to DD/MM/YYYY in Javascript  using Split function



var myString= $("#"+field).datepicker({ dateFormat: "dd/mm/yy" }).val();

   var array = new Array();
   array = myString.split('/');
   var newDate = (array[1] + "/" + array[0] + "/" + array[2]);
   //alert(newDate);
   $('#'+field).val(newDate);
 

No comments:

Post a Comment

Pages