Jump to content
Changes to the Jaspersoft community edition download ×

Default date format with only date.


rushit

Recommended Posts

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

  • 2 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...