Formats date and time as "2000.01.20 17:00" - Node.js Date

Node.js examples for Date:Date Format

Description

Formats date and time as "2000.01.20 17:00"

Demo Code


Date.prototype.toFormattedString = function(include_time)
{
   str = this.getFullYear() + "." + Date.padded2(this.getMonth()+1) + "." + Date.padded2(this.getDate());
   if (include_time) { str += " " + this.getHours() + ":" + this.getPaddedMinutes() }
   return str;//from   ww  w .  j av  a2 s .c o m
}

Related Tutorials