• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ulf Dittmer
Rancher
Posts: 42968
73
  • 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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
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: 42968
73
  • 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
Pie
Posts: 64959
86
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.
 
Stefan Evans
Bartender
Posts: 1743
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try "en_GB" as the locale string.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic