wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Passing Date to Jasper Report" Watch "Passing Date to Jasper Report" New topic
Author

Passing Date to Jasper Report

Keshav Savant
Greenhorn

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 java.lang.String...is 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
Keshav
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Passing Date to Jasper Report
 
Similar Threads
Date formatting
SimpleDateFormat
Editor with JDialog
converting a string into a date
problem with dates