Hi
i have to write a function which will build a SQL for a certain range of dates. But i am unable to compare the date
My code is
------------------------
public
String loopDate(String d1,String d2) throws ParseException
{System.out.println(d1);
String dql = "select";
java.util.Date tdate ;
java.util.Date fdate;
tdate = new SimpleDateFormat("MM/dd/yy").parse(d1);
fdate = new SimpleDateFormat("MM/dd/yy").parse(d2);
//tdate = new SimpleDateFormat("yyyy-MM-dd").parse(d1);
String strOutDt = new SimpleDateFormat("MMM-yyyy").format(tdate);
System.out.println(tdate);
System.out.println("the date is"+ strOutDt);
// i want to run this loop while tdate<= fdate)
While (tdate <= fdate); // will throw an error
{
dql = dql + new SimpleDateFormat("MMM-yyyy").format(tdate);
}
return dql;
---------------------------------------------------------------
How do i compare the date in while
my dql = select Nov-2003 Dec-2003 .........................