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!

cannot convert from java.util.Date to java.sql.Date

843840May 22 2009 — edited May 22 2009
In the below code am trying to get the current date and 60 days prior date:
Date  todayDate;
		Date  Sixtydaysprior;
		String DATE_FORMAT = "MM/dd/yy";
		
		DateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
		
	    Calendar cal = Calendar.getInstance();
		todayDate = sdf.parse(sdf.format(cal.getTime()));
		
		cal.add(Calendar.DATE, -60);
	    Sixtydaysprior = sdf.parse(sdf.format(cal.getTime()));
I have imported following files:
<%@page
	import="java.util.Calendar,
			java.text.SimpleDateFormat,
			java.text.ParseException,
                        java.util.*"
%>
Shows up following error msg:

Type mismatch: cannot convert from java.util.Date to java.sql.Date

Thanks.

Edited by: MiltonDetroja on May 22, 2009 11:03 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 19 2009
Added on May 22 2009
1 comment
1,285 views