This week's giveaway is in the Java/Jakarta EE forum.
We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line!
See welcome thread
Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

formatDate issue  RSS feed

Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting today's date using java.util.Date and formatting using formatDate tag.

<jsp:useBean id="now" class="java.util.Date" />
<fmt:formatDate value="${now}" pattern="dd-MMM-yyyy" var="todayDate" />

However, when I display ${todayDate}, it is displaying differently for users depending on their system and browser settings.

For example, for a korean user, it displays 31-10?-2008 (notice the ? after month). For a sweden user, it displays 31-Okt-2008 (notice Okt instead of Oct).

Setting the locale and timezone on the page did not solve the problem.
<fmt:setLocale value='en-US' scope="page" />
<fmt:setTimeZone value='America/New_York' scope="page" />

What am I missing ?
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!