Let say start date is 25/5/2000 and end date is 25/6/2000. The duration in month is 1 month only then i need return 1 year. Example: if the actual duration is 2 years 3 month the method return 3 years. Can someone help me? Thanks.
So if hte duration is less than 365 days, you want your app to display one year. If it is less than 3*365 days, you want it to display 3? I wonder what would happen if your application divided 30 days by some constant equal to the number of days in a year?
posted 10 years ago
yes, Chad Clites's solution is good. but i don't know how to get number of days in a year (365 or 366)? example 25/5/2000 to 24/5/2001 should return 1 year (365 days) and 25/5/2003 to 24/5/2004 (leap year) also return 1 year (366 day).