tedpet5 Posted April 29, 2013 Share Posted April 29, 2013 I have sucessfully added joda to my classpath and I can display org.joda.time.LocalDate in my report.I can not seem to figure out how to apply a formatter. I know that the joda formatter looks different than the java flavor.what is the secret to formatting joda dates whilst in ireport? Ted Link to comment Share on other sites More sharing options...
tedpet5 Posted April 30, 2013 Author Share Posted April 30, 2013 I was hoping that if the joda .jar was in the classpath, then the datetimeformat would be available.but no! materialsClose is a joda LocalDate. so its Field Class is org.joda.time.LocalDate.I tried this as an attempt to have a formatted date, but(new DateTimeFormat.forPattern("MMMM, yyyy").print($F{materialsClose}))but the compile error I get is:DateTimeFormat.forPattern cannot be resolved to a type.I am importing org.joda.time.DateTime. is there something more I have to import? Link to comment Share on other sites More sharing options...
tedpet5 Posted May 1, 2013 Author Share Posted May 1, 2013 someone must know about Joda and iReports!!!! Link to comment Share on other sites More sharing options...
Solution tedpet5 Posted May 16, 2013 Author Solution Share Posted May 16, 2013 I found an answer.Originally I had a field that was a localdate. $F{materialsClose}. I was defining its properties/field class to be: org.joda.time.LocalDateInstead, I set the field class to java.lang.Stringthen the "text field expression" for the textField is: new org.joda.time.LocalDate($F{materialsClose}).toDate()set the pattern to the format and voila, a properly formatted LocalDate. Link to comment Share on other sites More sharing options...
hozawa Posted May 26, 2016 Share Posted May 26, 2016 When you checked a post to show it's been resolved, nobody else can't post an answer. 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