• Post Reply Bookmark Topic Watch Topic
  • New Topic

Passing Date to Jasper Report  RSS feed

Keshav Savant
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!