Javascript Date formatLongDate()

Description

Javascript Date formatLongDate()


Date.prototype.formatLongDate = function() {
  //returns user friendly long date string, eg: Monday, Oct 26, 2015, 3:11 PM
  var options = {
    weekday: "long",
    year: "numeric",
    month: "short",
    day: "numeric",
    hour: "2-digit",
    minute: "2-digit"
  };/*  w w  w . jav a 2  s  . co m*/

  return this.toLocaleTimeString("en-us", options);
}



PreviousNext

Related