File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes Passing Date to Jasper Report Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Passing Date to Jasper Report" Watch "Passing Date to Jasper Report" New topic

Passing Date to Jasper Report

Keshav Savant

Joined: May 24, 2004
Posts: 1
Hello Experts,
I am facing a problem while passing date type parameters to jaster report. I am using SQL Server as my RDBMS. When i am passing the date in the form of string the erroer message says "can't convert string to date" on the other hand while passed the date in the form of Date(java.util.Date) the error says "Incompatible data type"... i tried all the combinations possible for the same problem..but in vain..
My report is getting two parametrs for date dtfr and dtto (both defined as of type it correct ?..if not then what it should be) and while i pass it from the jsp page the code is as below

//while passing as date type dtFrom and dtTo are java.util.Date type
SimpleDateFormat dateFormatter = new SimpleDateFormat("MM/dd/yyyy");
dtFrom = dateFormatter.parse(datefrom);
dtTo = dateFormatter.parse(dateto);
//datefrom and dateto has the date in "mm-dd-yyyy" format

i also tried by passing strings datefrom and dateto itself also but no outcome..
can any body suggest how can we pass the date type parameters to jasperreports..explaining each step.. if possible please supply a sample code
Thanks to all
I agree. Here's the link:
subject: Passing Date to Jasper Report
It's not a secret anymore!