This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hi, Could any one tell me a simple logic to get No.of DAY's between 2 dates? Example: Start date:22/03/04 EndDate: 22/03/03 I want to get No. of SUNDAY's between these two dates. Could any one tell me simple logic? Thanks --swapna
Howdy. Here's some logic for ya: Calendar start = GregorianCalendar set to 22/03/04 Calendar end = GregorianCalendar set to 22/03/03 int count = 0 while(start < end) get day of week of date in start, if day matches Calendar.SUNDAY increment count by one increment start by one day
You'll have to decide whether to include the start and end days in the calculation, which means adjusting the start day and the comparison between start and end as appropriate. Now get coding! [ March 22, 2004: Message edited by: Carlos Failde ]