Jump to content

Add zone Time to my field date of type String


salma.aboumzrag

Recommended Posts

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

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

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

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