In the following snipped the property $F
is of class java.time.LocalDateTime
or java.time.LocalDate
.
<textField pattern="EE. dd.MM.yyyy">
<reportElement...>
</reportElement>
<textFieldExpression><![CDATA[$F{theLocalDateTime}]]></textFieldExpression>
</textField>
How can I format this property with textField pattern
in jasper reports?
To use the pattern attribute in current version of jasper-report for Date/Time object you need a
java.util.Date
class or one of it's subclasses.The solution is to convert
java.time.LocalDate
andjava.time.LocalDateTime
Converting to
java.util.Date
from
java.time.LocalDate
from
java.time.LocalDateTime
Converting to
java.sql.Timestamp
from
java.time.LocalDate
from
java.time.LocalDateTime