rushit Posted February 22, 2010 Share Posted February 22, 2010 Hi,I am using Jasper report to show some data on HTML and EXCEL. These reports show date and I have not set any specific date format for these on report layout. When I render them I get these date in format like 22/02/2010 15:30. What I want is the date to appear with just 22/02/2010. Hence excluding time component. I know that by setting date format I will get this result but I also want date to appear as per the locale passed in report. With date format set I am not getting it.Can someone help me to know as to how this can be achieved? Thank you for you time. Link to comment Share on other sites More sharing options...
mdahlman Posted March 5, 2010 Share Posted March 5, 2010 You could use the following in a String field (not a Date field) to format MyDateParam which is a java.util.Date:DateFormat.getDateInstance(DateFormat.SHORT, $P{REPORT_LOCALE}).format( $P{MyDateParam} )That will be a localized short date format. I formatted a parameter, but it would work equally well for a field. It should certainly be good for your HTML report. You'll need to test in Excel. The fact that it's a string rather than date might not be what you want.Regards,Matt 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