日期格式化Jasper / ireports中文本的一部分 [英] Date formatting part of text in Jasper / ireports

查看:139
本文介绍了日期格式化Jasper / ireports中文本的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何格式化日期字段(数据库字段)显示Jasper / iReports中的文本部分(4.5.1)

how do I format a date field (database field) displayed part of a text in Jasper / iReports (4.5.1)

通过文本字段显示报告...(请使用Groovy)

Displayed via a text field in the report... (using Groovy please)

此日期的子总数:+ $ F(DEPOSIT_DATE)

"Sub total for this date: " + $F(DEPOSIT_DATE)

我试过(新的SimpleDateFormat(MM / dd / yyyy))。解析($ F {DEPOSIT_DATE})我收到错误消息:

I have tried (new SimpleDateFormat("MM/dd/yyyy")).parse($F{DEPOSIT_DATE})and I am getting error message:

net.sf.jasperreports.engine.fill.JRExpressionEvalException: 
Error evaluating expression : Source text : (new SimpleDateFormat("MM/dd/yyyy")).parse($F{BANK_DATE}) 

我想要什么在我的报告中显示如下...

What I want to display in my report is as follows...

此日期的子总数:MM / DD / YYYY - 格式...

Sub total for this date: MM/DD/YYYY - format...

推荐答案

试试这个:

new SimpleDateFormat("MM/dd/yyyy").format($F{BANK_DATE})

这篇关于日期格式化Jasper / ireports中文本的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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