• 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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 ]
 
Marshal
Posts: 67225
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
Marshal
Posts: 67225
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 ]
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!