Returns a formatted post Date for a given timestamp - Node.js Date

Node.js examples for Date:Date Format

Description

Returns a formatted post Date for a given timestamp

Demo Code


/**/*from  w  w w.  ja  va  2s.  co m*/
 * Date.getPostDate()
 * Returns a formatted postDate for a given timestamp
 *
 * @timestamp
 *    Optional timestamp for which to return a post date, if none is specified,
 *    current post date will be used
 */
Date.prototype.getPostDate = function() {
  //declare vars

  return this.getMonth() + '_' + this.getDate() + '_' + this.getFullYear();

};

Related Tutorials