This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

fmt:formatDate with an "en" locale formats like "en_US"  RSS feed

 
Rancher
Posts: 42975
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought the following JSP snippet would print out the date formatted according to German, English (UK) and English (US) custom. But English (UK) is "8/2/2006" -just like en_US- when I was expecting the day to come before the month. Isn't that the UK custom, or am I misunderstanding how date formatting works in JSTL?



Result:


[ August 02, 2006: Message edited by: Ulf Dittmer ]
 
Author and ninkuma
Marshal
Posts: 66784
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the locale that your browser is set to?

What happens if you are explicit with "en_UK"?
[ August 02, 2006: Message edited by: Bear Bibeault ]
 
Ulf Dittmer
Rancher
Posts: 42975
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
en_UK does the same as en_US and en.

According to the JSTL docs the browser settings are ignored if fmt:setLocale is used, and that's indeed what's happening (i.e., the accepted languages don't make a difference).
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66784
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, I'll guess I'll have to let our UK bretheren weigh in on whether the date format is correct or not.
 
Bartender
Posts: 1844
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try "en_GB" as the locale string.
 
Ulf Dittmer
Rancher
Posts: 42975
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Stefan. en_GB works fine (it produces "03/08/06").

Somehow I was under the impression that "en" would default to UK usage, but apparently it defaults to US usage.
[ August 03, 2006: Message edited by: Ulf Dittmer ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!