Returns the numeric representation of the day of the year. - Node.js Date

Node.js examples for Date:Day

Description

Returns the numeric representation of the day of the year.

Demo Code


/*/*from w ww.j a  va2 s  .  c o  m*/
 Returns the numeric representation of the day of the year.

 Source: http://javascript.about.com/library/bldayyear.htm
 */
Date.prototype.getDayOfTheYear = function() {
    var onejan = new Date(this.getFullYear(),0,1);
    return Math.ceil((this - onejan) / 86400000);
}

Related Tutorials