View Full Version : Solved: How many days in year
Hei.
How to calculate how many days is in the year. 365 or 366 ?!
:doh:
Tommy
11-14-2005, 07:16 AM
Private Function GiveNumDaysInYear(Year As Long) As Integer
GiveNumDaysInYear = IIf(Year Mod 4, 365, 366)
End Function
TonyJollans
11-14-2005, 10:12 AM
Hi Cass,
Tommy's solution isn't quite complete as it doesn't cater for 'century years'. This should give the right answer for all yearsFunction DaysInYear(Year As Long) As Long
DaysInYear = 365 - (Year Mod 4 = 0) + (Year Mod 100 = 0) - (Year Mod 400 = 0)
End Function
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.