This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I want to display the dates between from date to todate...i.e.,if the from date is:2007/01/01 and todate is: 2007/03/01..I want the intermediate date 2007/02/01...I tried to display the dates...But Its not giving me the required(dates between from date and to date)....Its giving some random numbers..
Please help me...
[ November 23, 2007: Message edited by: shalini gnana ] [ November 23, 2007: Message edited by: shalini gnana ]
Rob,I don't want the date difference or the random date difference... I want exactly the dates between the start date and the end date.... say, from date is 2007/01/01 and to date is 2007/01/05. I want the intermediate dates, 2007/01/02,2007/01/03,2007/01/04
Ah, now I get it. You don't just want the middle date, but all dates in between.
When calculating with dates, always use Calendar instead of Date, since Calendar takes daylight savings time etc into account. If needed, use the add or roll methods, as these also handle new months and years as needed.
Also, "mm" in a date format is the number of minutes. You need "MM" for the month. For performance reasons you will want to declare and initialize that SimpleDateFormat before the loop, not inside. [ November 23, 2007: Message edited by: Rob Prime ]
Joined: Sep 18, 2007
Thanks alot for your help..Now,I could able to display..