on 10-21-2015 1:57 PM
Hi ,
I am facing issue while formatting date/time in specified format using jasper pattern. For Date/Time field, if i am using pattern as dd/MM/yy ,in report data is getting displayed as 09/MM/15 instead 09/10/15 . If i use pattern as dd/mm/yy data is getting formatted incorrectly.Let me know if i am using any wrong format of there is required any additional configuration.
Regards, Ashwini
Hi Ashwini,
Could you remove the pattern attribute from the textfield element and try the below as the textFieldExpression?
<textFieldExpression class="java.lang.String"><![CDATA[new java.text.SimpleDateFormat("dd/MM/yyyy").format($F{CREATION_DATE})]]></textFieldExpression>
Regards, Shwetha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shwetha,
I had tried with same approach as you mentioned.It's working fine after exporting the report but if someone wants to change the format using spreadsheet date format as per their need,it's not formatting correctly.
Regards, Ashwini
Hi Shwetha,
Please find text field expression below.
<fieldname="CREATION_DATE"class="java.sql.Timestamp"/>
<textField pattern="dd/MM/yyyy">
<reportElement x="0" y="0" width="89" height="60"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.util.Date"><![CDATA[$F{CREATION_DATE}]]></textFieldExpression>
</textField>
To resolve this issue,i have tried using simple date format and it was formatting correctly.But if i was changing the date format in generated report,it was not incorrectly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.