Hi, You can do it using API. But i feel that it will be easy applying your own logic. For example parse the given dates and get the startyear,endyear,startmonth,endmonth. Now years=endyear-startyear; months=(years-2)*12; //since start year and end year are not completely included months=months+(endmonth-1)+(12-startmonth);//since start month and end months are not completely inlcuded. Correct me if i am wrong
Hi! I agree with the fact that using logic to solve this will be very helpful in developing the programming skills. However, in case you want to try your hands on APIs, then the class java.util.GregorianCalendar will be helpful. refer to the Javadoc and you will know how to use them.