Wednesday, 13 July 2016

formated date in jquery/javascript

function getFormattedDate(formatedDate) {
  var year = formatedDate.getFullYear();
  var month = (1 + formatedDate.getMonth()).toString();
  month = month.length > 1 ? month : '0' + month;
  var day = formatedDate.getDate().toString();
  day = day.length > 1 ? day : '0' + day;
  return month + '/' + day + '/' + year;
}

No comments:

Post a Comment