如何在JasperReports中以HH:mm:ss格式显示日期? [英] How to display date in HH:mm:ss format in JasperReports?

查看:179
本文介绍了如何在JasperReports中以HH:mm:ss格式显示日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码在JasperReports中生成图表。

I am using following code to generate chart in JasperReports.

<xyLineChart> 
    <chart evaluationTime="Band"> 
        <reportElement x="0" y="0" width="555" height="500"/> 
    </chart> 
    <xyDataset> 
        <dataset incrementType="None"/> 
        <xySeries> 
            <seriesExpression><![CDATA["CpuUsageGraph"]]></seriesExpression> 
            <xValueExpression><![CDATA[new Long($F{time}.getTime())]]></xValueExpression> 
            <yValueExpression><![CDATA[$F{cpuUsage}]]></yValueExpression>
        </xySeries> 
    </xyDataset> 
    <linePlot> 
        <plot/> 
    </linePlot> 
</xyLineChart>

我在X轴上打印日期,但它以毫秒为单位显示。
如何以 hh:mm:ss 格式显示?

I am printing the date on the X-axis, but it is displaying in milliseconds. How do I display it in hh:mm:ss format?

推荐答案

您可以在Java中使用以下代码:

You can use following code in Java:

new SimpleDateFormat("MM-dd-yyyy HH:mm:ss z").format($V{VAR_DATE})

其中 $ V {VAR_DATE 是要转换为格式的日期变量。

where $V{VAR_DATE} is the date variable to be converted into the format.

这篇关于如何在JasperReports中以HH:mm:ss格式显示日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆