Month: April 2013
Using JavaScript to Determine the Number of Days Between the Beginning of the Year and a Given Date
I recently came across the need to determine how many days fell between the beginning of the year and a given date. The most convenient way to do this is to add a new method to the Date object. Let’s get started! Date.prototype.getDOY = function() { var januaryFirst = new Date(this.getFullYear(),0,1); return Math.ceil((this – januaryFirst)…