Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Convert String Date to GregorianCalendar

843841Mar 7 2004 — edited Mar 7 2004
anyones noes the coding for the converstation of Date as in String format to GregorianCalendar??

I have a piece of coding here.. but wen i called this method.. Its gives me a null pointer error.. Btw.. im using Tomcat to run tat.. coz im doing JSP and servlets now..

public GregorianCalendar convertDate(String date)
{
int day, month,year;
day = Integer.parseInt(date.substring(0,2));
month= Integer.parseInt(date.substring(3,5));
year = Integer.parseInt(date.substring(6,10));
return new GregorianCalendar(year, month-1, day);
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 4 2004
Added on Mar 7 2004
1 comment
621 views