white_falcon02 Posted February 27, 2019 Share Posted February 27, 2019 Hi all,In Jaspersoft Studio 7, I am looking to add a report created line on the Last Page Footer band. I am using the following line in a text field: "Report created " + new java.util.Date().I am looking to format it so that the output looks like "Report created 02/27/2019 2:30:00 PM EST" however the format I am getting with the above is "Report created WED Feb 14:30:00 EST 2019". Can someone assit me in correcting my pattern or expression so that I display the desired date and time? Link to comment Share on other sites More sharing options...
hozawa Posted February 27, 2019 Share Posted February 27, 2019 Something like below:"Report created " + new SimpleDateFormat("dd/MM/yyyy").format(new java.util.Date()) Link to comment Share on other sites More sharing options...
prusyn Posted February 28, 2019 Share Posted February 28, 2019 Hozawa's answer is correct, but to be more specfic to your requirements you need below expression: "Report created " + new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a z").format(new java.util.Date())[/code]Here's you find more information about date format patterns: https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html Link to comment Share on other sites More sharing options...
white_falcon02 Posted February 28, 2019 Author Share Posted February 28, 2019 Exactly like below! Thanks. I was trying to do it in the pattern for the text field and absolutely had a Java mental block. 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