if the Date field is a String value, say : "2014-11-20"
<field name="dateField" class="java.lang.String"/>
then you can do this
<variable name="THE_DATE" class="java.util.Date">
<variableExpression>
<![CDATA[new java.text.SimpleDateFormat("yyyy-mm-dd").parse($F{dateField})]]>
</variableExpression>
</variable>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement x="0" y="0" width="88" height="20" uuid="47b41787-a8fd-44ea-bf96-7e5484e477fb"/>
<textElement textAlignment="Left" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[ $V{THE_DATE} ]]></textFieldExpression>
</textField>
You can set the pattern by
right clicking the field -> click field pattern -> Select Date -> Choose a Date Pattern
you may also do this
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="88" height="20" uuid="47b41787-a8fd-44ea-bf96-7e5484e477fb"/>
<textElement textAlignment="Left" verticalAlignment="Middle"/>
<textFieldExpression class="java.util.Date"><![CDATA[ new java.text.SimpleDateFormat("dd/MM/yyyy").format(new java.text.SimpleDateFormat("yyyy-mm-dd").parse($F{dateField})) ]]></textFieldExpression>
</textField>
However,If the DateField is of type Date
then doing the below is just fine.
<field name="dateField" class="java.util.Date"/>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement x="0" y="0" width="88" height="20" uuid="47b41787-a8fd-44ea-bf96-7e5484e477fb"/>
<textElement textAlignment="Left" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[ $F{dateField} ]]></textFieldExpression>
</textField>