Calculate sum of days within certain years

Hi everyone.

I would like to calculate the sum of days within certain years. For example, from 2020 to 2024.
So, I need to first determine whether the year is a leap year or not.
If the year is a leap year, add 1 to the array index and multiply by 365. If the year is not a leap year, add 1 to the array index and multiply by 366.
Add these two values together. I assumed that only one value would be printed out, but it wasn’t. Then I tried to assign it to an array. By using Max of Int Array, I extracted the max value, but it didn’t work either.
So, how can I get the correct value?



SumOfDateInYearsResult

Wouldn’t this work:

I might have missed the point completely, though.

3 Likes

@Everynone This seems like a perfect solution, and will allow you to disregard the leap year calculation completely. It worked when I tried it!

Thank you very much! It works!