Javascript Date getLastDateInMonth(months)

Description

Javascript Date getLastDateInMonth(months)


/**/*from   w w  w .  ja  v a2s.  c  o m*/
* Return last date in month from "date + months"
*
* @param   {date}
*/
Date.prototype.getLastDateInMonth = function (months){
  months = parseInt(months);
  return new Date(this.getFullYear(), this.getMonth() + (months || 0) + 1, 0);
}



PreviousNext

Related