Javascript Date get_date()

Description

Javascript Date get_date()


/*//  w w  w  .  j  a  v  a  2 s  .  c o m
 * Date formatting.
 */

Date.prototype.get_date = function() {
  var year  = this.getFullYear(),
      month = this.getMonth() + 1,
      date  = this.getDate();
  if (month < 10)
    month = "0" + month;
  if (date < 10)
    date = "0" + date;
  return year + "-" + month + "-" + date;
}



PreviousNext

Related