Hi.
'd like to change format of actual date. My textfield:
"Day " + new java.util.Date()
Output is:
Day Wed Jan 28 13:32:40
But required output is:
Day 28.01.2009
How to write it correctly?
Thanx for answerr.
4 Answers:
On ireport u can set a defined patter for your field ;right click on the field and check the property .leave the class expression as java.lang.Date and edit the pattern.
Code: |
http://www.google.it/firefox?client=firefox-a&rls=com.ubuntu:en-US:official</td></tr></tbody></table> |
foster,
In general it's better to use a localized date format. Something like this:
DateFormat.getDateInstance(DateFormat.SHORT, $P{REPORT_LOCALE}).format( new java.util.Date() )
But if you prefer to hardcode the format in your case, you can do it like this:
new SimpleDateFormat("dd.MM.yyyy").format( $P{MyDateParam} )
See more details here:
http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html
Regards,
Matt
Thanks a lot I was trying something like this and got the solution from your post