• 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

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

 
Rancher
Posts: 42974
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: 66827
169
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: 42974
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: 66827
169
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: 1845
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try "en_GB" as the locale string.
 
Ulf Dittmer
Rancher
Posts: 42974
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 ]
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!