kondakindi
IS-IT--Management
Hi,
I have a Date coming from a string variable of a form into a servlet .where i compare the date i it is greater than current date it gives always error invalid start date
the code is as follows could u tell me what is the error as i have used calendar class
String syear="2005";
String smonth="7";
String sdate="18";
Calendar sCalendarDate = Calendar.getInstance();
sCalendarDate.set((new Integer(smonth).intValue()),(new Integer(sdate).intValue()),(new Integer(syear).intValue()));
Calendar eCalendarDate = Calendar.getInstance();
eCalendarDate.set((new Integer(emonth).intValue()),(new Integer(edate).intValue()),(new Integer(eyear).intValue()));
Calendar nowCalendarDate = Calendar.getInstance();
if(sCalendarDate.before(nowCalendarDate))
System.out.println("Should be not less than current date"+sdate+smonth+syear);
else
System.out.println("valid");
if(eCalendarDate.before(nowCalendarDate) || (eCalendarDate.before(sCalendarDate)))
System.out.println("The End Date of the Job being posted must be later than the current Date!");
else
System.out.println("valid endadate");
Is it that i cannot use calander class to compare becoz when i print the noeCalendarDate it gives a big para
Do let me know
Thanks
I have a Date coming from a string variable of a form into a servlet .where i compare the date i it is greater than current date it gives always error invalid start date
the code is as follows could u tell me what is the error as i have used calendar class
String syear="2005";
String smonth="7";
String sdate="18";
Calendar sCalendarDate = Calendar.getInstance();
sCalendarDate.set((new Integer(smonth).intValue()),(new Integer(sdate).intValue()),(new Integer(syear).intValue()));
Calendar eCalendarDate = Calendar.getInstance();
eCalendarDate.set((new Integer(emonth).intValue()),(new Integer(edate).intValue()),(new Integer(eyear).intValue()));
Calendar nowCalendarDate = Calendar.getInstance();
if(sCalendarDate.before(nowCalendarDate))
System.out.println("Should be not less than current date"+sdate+smonth+syear);
else
System.out.println("valid");
if(eCalendarDate.before(nowCalendarDate) || (eCalendarDate.before(sCalendarDate)))
System.out.println("The End Date of the Job being posted must be later than the current Date!");
else
System.out.println("valid endadate");
Is it that i cannot use calander class to compare becoz when i print the noeCalendarDate it gives a big para
Do let me know
Thanks