eddie_4 Posted July 17, 2017 Share Posted July 17, 2017 I previously had an issue of how to stop local timezone conversion for DOB fields. User darth_fader provided a quick and simple solution. However, now the textfield pattern is being ignored. I have MM/dd/yyyy for the pattern but the report is formatting as yyyy-MM-ddT00:00:00. <textField pattern="MM/dd/yyyy" isBlankWhenNull="true"> <reportElement x="123" y="0" width="88" height="20" uuid="40bfec19-25c5-4807-801f-464034799729"/> <textElement> <font fontName="Arial" isBold="false"/> </textElement> <textFieldExpression><![CDATA[new org.joda.time.DateTime($F{dob}).withZone(org.joda.time.DateTimeZone.forID("UTC"))]]></textFieldExpression> </textField>[/code] Link to comment Share on other sites More sharing options...
Solution darth_fader Posted July 17, 2017 Solution Share Posted July 17, 2017 Put this in your text field expression: org.joda.time.format.DateTimeFormat.forPattern("MM/dd/yyyy").print(new org.joda.time.DateTime($F{dob}).withZone(org.joda.time.DateTimeZone.forID("UTC"))) There may be a way to preserve the format attribute on the text field tag, if that's a necessity let me know 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