Jump to content
Changes to the Jaspersoft community edition download ×

Pattern format ignored on textfield using joda.time value


eddie_4
Go to solution Solved by darth_fader,

Recommended Posts

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

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Solution
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

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