salma.aboumzrag Posted March 29, 2023 Share Posted March 29, 2023 I added this param: <parameter name="DateFormatter" class="java.text.DateFormat" isForPrompting="false"> <defaultValueExpression><![CDATA[$P{REPORT_FORMAT_FACTORY}.createDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", $P{REPORT_LOCALE}, $P{REPORT_TIME_ZONE})]]></defaultValueExpression> </parameter>And here is my expression : <textFieldExpression><![CDATA[$P{DateFormatter}.format($F{createDateTime})]]></textFieldExpression>Error message: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: $P{DateFormatter}.format($F{createDateTime}) Link to comment Share on other sites More sharing options...
anish.rai Posted March 30, 2023 Share Posted March 30, 2023 Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times. Link to comment Share on other sites More sharing options...
Scott Andersen Posted March 30, 2023 Share Posted March 30, 2023 The "java.text.DateFormat.format()" method is used to format a Date into a specific formatted string. You seem to be trying to take a string field and translate it into a Date" object. This requires different java code.To format a date into a specific string format, use the "Pattern" or the "PatternExpression" property of the text field. Link to comment Share on other sites More sharing options...
salma.aboumzrag Posted March 31, 2023 Author Share Posted March 31, 2023 Yes I used a new java code for my field : $P{DateFormatter}.format(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse($F{createDateTime})) but i can't set the time zone to "Europe/paris", however the time zone of my date is +00.can you help me ? 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