Jump to content
Changes to the Jaspersoft community edition download ×

Show Date In Another Locale


jjones_4
Go to solution Solved by hozawa,

Recommended Posts

I need to show a date in a language defined by a locale that is stored in a string variable named "locale".

new SimpleDateFormat("EEEE, MMMM d, YYYY", Locale.forLanguageTag("es-MX")).format(new Date("09/01/2016"))

This code returns "jueves, septiembre 1, 2016" which is what I need.

 

However, if I store the "es-MX" in a simple string variable and replace the hard-coded locale with the variable, it returns NULL:

new SimpleDateFormat("EEEE, MMMM d, YYYY", Locale.forLanguageTag($V{locale})).format(new Date("09/01/2016"))

 

I have also replaced the Locale.forLanguageTag("es-MX") with new Locale("es", "MX") but get the same result.

 

Does anyone know of a way to accomplish this?

 

Thanks,

Danny

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...