shraddha.s.mirashi Posted April 19, 2013 Share Posted April 19, 2013 Hi,I am new to Jasper Reports, using iReport. Want to know how to specify default value to Date? Also want default date format.Thanks in advance.. Link to comment Share on other sites More sharing options...
hawkx Posted April 19, 2013 Share Posted April 19, 2013 Maybe you should try this, create a style in report and mark it as default, set the property "Pattern" to what you want. Link to comment Share on other sites More sharing options...
hawkx Posted April 19, 2013 Share Posted April 19, 2013 Maybe you should try this, create a style in report and mark it as default, set the property "Pattern" to what you want. Link to comment Share on other sites More sharing options...
shraddha.s.mirashi Posted April 19, 2013 Author Share Posted April 19, 2013 Thank you for ur reply. Actually i want to this parameter in query. And if i set its default value as '01/01/2013', i get ClassCastException. So i want to know what exact format it expects. Link to comment Share on other sites More sharing options...
ajinkya_c Posted April 30, 2013 Share Posted April 30, 2013 Hi I think you need to find the date format supported by your datasource database.Example: Oracle: '30-April-2013' Link to comment Share on other sites More sharing options...
Create Posted October 12, 2018 Share Posted October 12, 2018 I can't find any way to do this directly, but here's a workaround:1) First make the parameter's type String rather than Date.2) Then enter a Default value expression for the date literal like this: "2018-01-23"3) Finally, use something like the following, which might need to get adjusted for the type of SQL you're using:For MariaDB (or MySQL) SQL use: STR_TO_DATE($P{From},"%Y-%m-%d"), where you need to first replace 'From' with the name of your actual parameter.This allows you to easily edit the default value as a string, and then use it as a date type in your SQL. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now