foster Posted January 28, 2009 Share Posted January 28, 2009 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.2009How to write it correctly?Thanx for answerr. Link to comment Share on other sites More sharing options...
fgar Posted January 28, 2009 Share Posted January 28, 2009 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 Link to comment Share on other sites More sharing options...
foster Posted January 28, 2009 Author Share Posted January 28, 2009 But I have class expression as string because of joinig some string together in this textfield. And one is Date. Link to comment Share on other sites More sharing options...
mdahlman Posted January 28, 2009 Share Posted January 28, 2009 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 Link to comment Share on other sites More sharing options...
foster Posted January 29, 2009 Author Share Posted January 29, 2009 Thanx for answer. My mistake was: "Dňa " + new SimpleDateFormat("dd.MM.yyyy").format(java.util.Date()) But correct is: "Dňa " + new SimpleDateFormat("dd.MM.yyyy").format(new java.util.Date()) Link to comment Share on other sites More sharing options...
raj.john Posted May 27, 2014 Share Posted May 27, 2014 Thanks a lot I was trying something like this and got the solution from your post Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now