Find Number of Days in a Year

Your rating: None Average: 3.4 (5 votes)

Number of days in a year can be calculated by finding the 1st day of the next year and subtract that from the 1st day of the current year.

Find first day of next year

 SELECT add_months(TRUNC(sysdate,'y'),12)
  FROM dual;


1 rows selected

Find first day of current year

SELECT TRUNC(sysdate,'y')
 FROM dual;


1 rows selected

Finding days for the current year is an easy task now, just subtract the two dates and your done.

 SELECT add_months(TRUNC(sysdate,'y'),12) - TRUNC(sysdate,'y')
  FROM dual;


1 rows selected

Please try to help out with unanswered topics on the forum. Chances are you have had the same issue/question some time in your IT career!


Have a question? Please ask it on the forum instead.

Post new comment

The content of this field is kept private and will not be shown publicly.
The question below is to prevent automated spam submissions.
5 + 6 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.