Reputation: 21364
If I'm in Europe, Germany, and I use:
<fmt:formatDate value="${now}" type="BOTH" timeZone="America/Los_Angeles"/>
the date and time are formatted always as
17-05-2011 1.32.10
and not as in English format with first month and then day.
Only the time zone is corrected.
Why?
Thanks.
Upvotes: 1
Views: 1634
Reputation: 5694
If you don't want to use an explicit pattern and always want to force the use of a single locale, you can try including the following in your web.xml:
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.locale</param-name>
<param-value>en_US</param-value>
</context-param>
You shouldn't have to use <fmt:setLocale>
with this approach. You can also get and set configuration data through the javax.servlet.jsp.jstl.core.Config
class (for example, in a listener, filter or servlet).
Upvotes: 1
Reputation: 240928
You need to override pattern
also, overriding timezone
won't change the output format
<fmt:formatDate value="${now}" type="BOTH" timeZone="America/Los_Angeles" pattern="MM/dd/yyyy HH:mm"/>
Upvotes: 2