0

I have a dateFormat in my onLoad function.Its format is like "Fri Jan 01 00:00:00 IST 2016".I need to change it to dd/mm/yy format.

My jsp field where i have to display the date

<input type="hidden" id="dateFormat" value="${per.ArrDate}">

My onLoad method

$(document).ready(function(){
  alert("inside onload");
  var dateFormat=$('#dateFormat').val();
  alert($.datepicker.formatDate('dd/mm/yy', new Date(dateFormat)));
});

How to change to "dd/mm/yy" format for the above input "Fri Jan 01 00:00:00 IST 2016".Any help will be highly appreciable.

Andy Turner
  • 137,514
  • 11
  • 162
  • 243
Miller
  • 744
  • 3
  • 15
  • 39

1 Answers1

0

Use this: https://github.com/phstc/jquery-dateFormat

 document.write($.format.date("Wed Jan 13 10:43:41 CET 2010", "dd~MM~yyyy"));