elenauscom.u Posted July 19, 2018 Share Posted July 19, 2018 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 More sharing options...
narcism Posted July 23, 2018 Share Posted July 23, 2018 In the JSON file you have dates in String format. If you want to treat them as dates in your report, you need to:declare the fields with the appropriate Date type(e.g. java.util.Date, java.sql.Date, etc.)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-ddset the desired pattern at textField level Link to comment Share on other sites More sharing options...
lenapac15.29 Posted July 23, 2018 Share Posted July 23, 2018 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 More sharing options...
narcism Posted July 23, 2018 Share Posted July 23, 2018 Please post some sample JRXML and the Studio version in order to reproduce your issue. 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