• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

date i18n

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

i have the following code, that works great in the US. I was hoping that it would also work great in the UK, but...
It returns US format in the UK. Any ideas as to why?

Thanks for any help you can offer,
Lisa
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What Locale is your UK machine configured to use? It may well be en_US too.
 
Lisa D'Aniello
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure. How do i find out?
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just examine the result of Locale.getDefault(). That will tell you. Though the DateFormat stuff you are using usses the default anyway, so it does look liek your JVM is configuered for an en_US Locale.
 
Lisa D'Aniello
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you so very much! For a minute there i was afraid that I had the entire concept of date formats wrong!
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've run your code from Ireland and was surprised to find my default SHORT was set to M/d/yy.
After looking this up it appears the Locale has to be explicitly set. I thought the JVM might have some way of picking this up at start-up.

Anyway you can avoid all of this unpleasantness by specifying the Locale when you get your DataInstance.

 
Lisa D'Aniello
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Barry,
Thanks for the code bit - i really appreciate it. I should not have to code for each locale of visitor I expect to see, since this should be as simple as getting the default date. I suppose that what I need to know is how to configure the JVM properly.

I appreciate everyones help - and if i ever figure out how to get it going, i'll post it back here for everyone else to use.

Originally posted by Barry Higgins:
I've run your code from Ireland and was surprised to find my default SHORT was set to M/d/yy.
After looking this up it appears the Locale has to be explicitly set. I thought the JVM might have some way of picking this up at start-up.

Anyway you can avoid all of this unpleasantness by specifying the Locale when you get your DataInstance.

 
reply
    Bookmark Topic Watch Topic
  • New Topic