src/Date.cpp
/*!
    Returns the day of the year (1 to 365 or 366 on leap years) for this date.

    Returns 0 if the date is invalid.
*/
Returns the day of the year (1 to 365 or 366 on leap years) for this date.
Returns 0 if the date is invalid.
Returns the day of the year ( 1 to 365 or 366 on leap years ) for this date . Returns 0 if the date is invalid .
int Date::dayOfYear(int year, int month, int day)
{
    if (!isValid(year, month, day))
        return 0;
    int days = 0;
    for (int i = 1; i < month; ++i)
        days += monthDays[i];
    if (isLeapYear(year) && month > 2)
        return days + day + 1;
    else
        return days + day;
}
int Date :: dayOfYear ( int year , int month , int day ) { if ( ! isValid ( year , month , day ) ) return 0 ; int days = 0 ; for ( int i = 1 ; i < month ; ++ i ) days += monthDays [ i ] ; if ( isLeapYear ( year ) && month > 2 ) return days + day + 1 ; else return days + day ; }
Returns the day of the year (1 to 365 or 366 on leap years) for this date.
Returns the day of the year ( 1 to 365 or 366 on leap years ) for this date .