How can i calculate the number of days in a year for any calendar, not just gregorian. I have tried this
NSUInteger *days = [[NSCalendar currentCalendar] range
I don't know objective-c but it is a simple algorithm to determine if it is a leap year.
if ( year % 400 == 0 )
then 366 // Leap Year
else if ( year % 100 == 0 )
then 365 // Non-Leap Year
else if ( year % 4 == 0 )
then 366 // Leap Year
else
365 // Non-Leap Year
Or if you want a little less verbose version
if ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0))
then 366 // Leap Year
else
365 // Non-Leap Year