开发者

converting date parameter to simpledate format using iReport

I have a startDate and an endDate as an input parameters. This parameters are used in the query say:

SELECT * FROM patientRecords 
WHERE patientRecords.dateOfdischarge BETWEEN $P{startDate} AND $P{endDate} 

Now, since the startDate and endDate are the parameters which are passed to the JasperReports.

I have to ensure that they are in mm/dd/yyyy Date format.

How do I go a开发者_JAVA百科bout converting the input parameter to this format using iReport?


U can try change the patern from propertise>textfield propertise or u can try this to_char(tablename.fieldname, 'mm/dd/yyyy') as fieldname


Try this format it will work if you are using Mysql database

date_column_name between date_format($P{start_date},'%Y-%m-%d') and date_format($P{end_date},'%Y-%m-%d') date_column_name between date_format($P{start_date},'%Y-%m-%d') and date_format($P{end_date},'%Y-%m-%d')


If I were you, I'll directly send these parameters as in the format you said from Java. If that not possible for you and wanna be sure, you can use EL for formatting as well such as Java or Groovy in the iReport

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜