Years in days

Hi,
i get 11199 days, but i know they are 11602. (31) :rolleyes:
Somebody helps me?

Which years? The counting of days depends on the number of leap years

31

:lol:

This doesn’t answer the question. It strongly depends also on the exact start year.
This script should count the days correctly.


property fromYear : 2000
property toYear : 2010

set dayCounter to 0
repeat with yr from fromYear to toYear
	set dayCounter to dayCounter + 337 + ((((yr mod 4 is 0) and ((yr mod 100 > 0) or (yr mod 400 is 0))) as integer) + 28)
end repeat
display dialog "The years " & fromYear & " thru " & toYear & " contain " & dayCounter & " days"


Stefan,

i tried a while, but yeah, i’m not so clever in maths.
Anyway, great and quick (omg) solution!
:cool:

set fromYear to 2000
set toYear to 2010

set fromDate to date "Saturday 1 January 1583 00:00:00"
copy fromDate to toDate
set fromDate's year to fromYear
set toDate's year to toYear + 1
display dialog "The years " & fromYear & " thru " & toYear & " contain " & (toDate - fromDate) div days & " days"

:wink:

very nice :slight_smile: