Jump to content
Changes to the Jaspersoft community edition download ×

Dateformat jaspersoft studio


Recommended Posts

Good afternoon. I'm having a problem with formatting the date. I use the json file adapter, which contains the property value "2018-01-01". This property is of type String. I start to enter the required format in the field pattern, but nothing happens, other classes also do not work. Can you please tell me what to do?


Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

In the JSON file you have dates in String format. If you want to treat them as dates in your report, you need to:

  1. declare the fields with the appropriate Date type(e.g. java.util.Date, java.sql.Date, etc.)
  2. specify the Date pattern in the Data Adapter file/dialog for proper conversion from String to your type. Your pattern may be something like: yyyy-MM-dd
  3. set the desired pattern at textField level
Link to comment
Share on other sites

I did it, but I can not. I specified the correct data type, I specified a pattern. It turned out only after I specified: new SimpleDateFormat ("yyyy-MM-dd"). Parse ($ F {invoiceDocDate}) in the field expression.

I do not know why it's impossible to change the type to java.util.Date, writes the error that you can not get data from the json file.

Thanks for the answer.

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...