lukmanars Posted August 2, 2011 Share Posted August 2, 2011 i have a problem like this, i make a text Field :$F(date_in)Expression Class = java.util.datePattern = EEEE dd MMMMM yyyyif i run my report, it should be like : Tuesday, 02 augustus 2011the problem is my boss want to display date in Indonesian language,it must be like : Selasa, 02 Agustus 2011Sunday --> MingguMonday --> SeninTuesday --> SelasaWednesday --> RabuThursday --> kamisFriday --> Jumatsaturday --> Sabtuthe problem is i dont know how to convert that default day into indonesia language,,anyone know how to resolve this problem?? :(Thanks,, Lukman Link to comment Share on other sites More sharing options...
lukmanars Posted August 3, 2011 Author Share Posted August 3, 2011 i'm using this code, but it didn't work,,i want to change Word "Wednesday" to "Rabu"Code:DateFormatUtils.format($F{TGL_IN},"EEEEE").equals("Wednesday")? "Rabu":"Bukan Rabu" Link to comment Share on other sites More sharing options...
despec Posted August 3, 2011 Share Posted August 3, 2011 Could it be as simple as you forgot to enclose the entire statement with parentheses?( DateFormatUtils.format($F{TGL_IN},"EEEEE").equals("Wednesday")? "Rabu":"Bukan Rabu" )Post Edited by despec at 08/03/2011 20:44 Link to comment Share on other sites More sharing options...
mdahlman Posted August 3, 2011 Share Posted August 3, 2011 Lukman,You are thinking of this problem the wrong way. Formatting the data to an English-language day of the week and then converting that manually to Indonesian is possible... but there's no reason to do it. Let Java do it for you: DateFormatUtils.format($P{MyDate},"EEEE, dd MMMMM yyyy",new java.util.Locale("id"))In fact... for this there's no reason you need Commons Lang. If you are already using it, then that's fine. But you could do the same thing like this:new SimpleDateFormat("EEEE, dd MMMMM yyyy",new java.util.Locale("id")).format($P{MyDate})When I run the above code (either one of them) with today's date I get this:Rabu, 03 Agustus 2011Regards,MattP.S. I guess that it would be better to create a Parameter with a default value of "new java.util.Locale("id")". Then use this param rather than creating a new Locale object everytime. But I'm not reallly a Java developer, so I'm not too sure. Link to comment Share on other sites More sharing options...
lukmanars Posted August 4, 2011 Author Share Posted August 4, 2011 whoa..thank you very much Matt.your answer is very helpful /tools/fckeditor/editor/images/smiley/msn/thumbs_up.gifthe first i use code : new SimpleDateFormat("EEEE, dd MMMMM yyyy",new java.util.Locale("id")).format(F${TGL_IN})with Expression Class is "java.util.Date"i got error : Cannot cast object 'Kamis, 16 Juni 2011' with class 'java.lang.String' to class 'java.util.Date' after that i change the expression class to "java.lang.String"Because i think that code like to_char() in SQL, that convert Date, into String and change the language..and than it can show, the result is "Kamis, 16 Juni 2011"once again, i want to say, thank you very much Matt.. ^_^Regards,Lukman Link to comment Share on other sites More sharing options...
miltenb Posted July 24, 2014 Share Posted July 24, 2014 I try : 2014-10-23 00:00:00.000 new SimpleDateFormat("yyyy-MM-dd HH:mm:ss" , new java.util.Locale("fr_FR")).format($F{date_start_raw2}) result : Cannot format given Object as a 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