gmcabral Posted January 12, 2011 Share Posted January 12, 2011 Hello *:I've the field $F{Fecha_y_hora-appointment_date}, string type, and I need to convert to date and assign a date pattern. The field is like "yyyy-MM-dd HH:mm:ss" and I like to show "dd/MM/yyyy HH:mm".I have found and I try this:new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse($F{Fecha_y_hora-appointment_date})But the result is like "Tue Jan 18 14:00:00"Please give me a hand.Gustavo.- Link to comment Share on other sites More sharing options...
madhuripatil Posted January 13, 2011 Share Posted January 13, 2011 Try this:- new SimpleDateFormat("dd/mm/yyyy").format(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse($F{Fecha_y_hora-appointment_date})) 1 Link to comment Share on other sites More sharing options...
gmcabral Posted January 13, 2011 Author Share Posted January 13, 2011 Yes yes, that's it, thanks a lot, I was lost. Thanks man, your the best! Link to comment Share on other sites More sharing options...
pjamack Posted August 12, 2011 Share Posted August 12, 2011 This has worked in TextVariables, if I create a varaible as a String, etc but if I try to create a DATE Variable and use the SImpleDate, Utils.Date or whatever to convert a String to Date, it throws Cannot Cast String to Date errors. If I change the Variable to String, then I could play around and make it work. But it defeats the purpose if I'm trying to convert returned Strings to Dates and then Group the Dates into Week One, Week Two, etc. Nobody seems to have a clue how to do this. Or maybe it's just not possible in Jasper to Convert String to Date and group by Week. Because Convert String to Date and just display it doesn't do anything for Grouping or putting dates into Weeks. It's still a String. Link to comment Share on other sites More sharing options...
szaharia Posted August 22, 2011 Share Posted August 22, 2011 Hi there,Could you post the JRXML sample here?Thank you,sanda Link to comment Share on other sites More sharing options...
pjamack Posted August 22, 2011 Share Posted August 22, 2011 I got the String to Date to work as a variable and then sort of use it in a crosstab as a column group. Right now I'm working on figuring a way to place nested ifs in a variable for days of weeks as a number. 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