In this post we will compute the number of hours in the specified month and year. This could be used to determine the cost for a feature if enabled every day for a specified month and year.
If one rounds up all months to have a fixed set of days, the result would not be correct. For example, a year has 12 months. Most months have a fixed set of days e.g., Jan, Mar, May, Jul, Aug, Oct, and Dec always have 31 days while Apr, Jun, Aug and Nov always have 30 days. This is not the case with Feb which on regular years it holds 28 days but on leap years it holds 29 days. Continue reading “Days in Month – Java”