如何在文本字段中格式化 java.time.LocalDate?

tho*_*mas 5 java jasper-reports java-time

我试图java.time.LocalDate在我的报告中显示以下格式:

<textField pattern="EEEEE dd MMMMM yyyy">
    <reportElement x="64" y="0" width="150" height="20" uuid="5e003c53-2327-4f75-9adf-831a3bb494ff"/>
    <textElement verticalAlignment="Middle">
        <font isBold="true" isUnderline="true"/>
    </textElement>
    <textFieldExpression><![CDATA[$F{dateFacture}]]></textFieldExpression>
</textField>
Run Code Online (Sandbox Code Playgroud)

但我得到的日期如下:2017-03-09。是由于 java.time.LocalDate 类型造成的吗?

Ole*_*.V. 4

只是为了证明这个问题已经得到解答,这里\xe2\x80\x99s是提问者在评论中报告的解决方案:

\n\n
<textFieldExpression>\n    <![CDATA[$F{dateFacture}.format(java.time.format.DateTimeFormatter.of\xe2\x80\x8c\xe2\x80\x8bPattern("EEEE d MMMM yyyy"))]]>\n</textFieldExpression>\n
Run Code Online (Sandbox Code Playgroud)\n


归档时间:

查看次数:

5413 次

最近记录:

8 年,10 月 前