vk01 Posted January 15, 2008 Share Posted January 15, 2008 Hi, The report displays as "2007-10-01" which i need it to show as "10/01/2007" - currently this is a variable with the following syntax - it was showing the time as well which was not required. It is set up as variable with datatype string: original date is - "2007-10-01 00:00:00"--$P{END_DATE}.substring(0, $P{END_DATE}.indexOf(" "))-- thanks. Link to comment Share on other sites More sharing options...
Pedja Posted January 16, 2008 Share Posted January 16, 2008 Can you set the field to java.util.Date? Then set the Text Field Expression to new Date($P{END_DATE}), and Pattern to "dd/MM/yyyy". Or you can experiment with SimpleDateFormat class. Link to comment Share on other sites More sharing options...
Pedja Posted January 16, 2008 Share Posted January 16, 2008 This should work: set the field to java.util.Date, Pattern to "dd/MM/yyyy", and Text Field Expression to (new SimpleDateFormat("yyyy-dd-MM")).parse($P{END_DATE}) Link to comment Share on other sites More sharing options...
vk01 Posted February 8, 2008 Author Share Posted February 8, 2008 I cannot set the parameter as java.util.date - it has to be a string. And this is not working if the parameter is a string. Any other way to format a string to a date. Link to comment Share on other sites More sharing options...
Pedja Posted February 10, 2008 Share Posted February 10, 2008 Leave the parameter as String, and set the TEXT FIELD to java.util.Date. Link to comment Share on other sites More sharing options...
vk01 Posted February 11, 2008 Author Share Posted February 11, 2008 It comes back with error message - Cannot cast from string to date. Link to comment Share on other sites More sharing options...
vk01 Posted February 12, 2008 Author Share Posted February 12, 2008 Solved! It is also posted in another thread. Set the text field to java.util.date - and then use following -- (new SimpleDateFormat("yyyy-MM-dd")).parse($P{START_DATE}) 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