JavaScript

DategetDaysInYear Method

Syntax

Date.getDaysInYear()

Returns

daysnumber

The total number of days in the year.

Description

Extension to the native date variable to the get the total number of days in the year of a given date.

Example

var d = new Date(2018,7,10);
var doy = d.getDayOfYear();
// doy = 221