Default date format with only date.



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.


rushit's picture
Joined: Aug 26 2009 - 3:21am
Last seen: 5 years 5 months ago

1 Answer:


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

mdahlman's picture
Joined: Mar 13 2007 - 2:43am
Last seen: 3 months 3 hours ago