MarcusH
MarcusH

Reputation: 1703

Is there a way to get a localized date/time based on a U.S format string?

I'm not sure these cases are possible, but I have format strings for a US locale,

1.  ccc \'at\' h:m a
2.  yyyy-MM-dd'T'HH:mm:ss.SSSZ

I want to format a Date object into another locale using the analagous format strings. For example, "Wed at 2:30 PM" should render as "Miercoles a la 10:30 am" in spanish.

Calendar.getDateInstance is great for localization, but relies on predefined integer constants that represent formats.

Upvotes: 1

Views: 57

Answers (1)

Brett Okken
Brett Okken

Reputation: 6306

If you are using a SimpleDateFormat, you will need to create an instance with the target Locale. If you are using a DateFormat style, you would need to get an instance for the target locale.

In both cases, it appears you want to change the timezone also.

Upvotes: 1

Related Questions