• 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

SimpleDateFormat and locale

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi i have problem in using SimpleDateFormat.

The code:
//------------------------------------------------------------------------
DateFormat df = new SimpleDateFormat("yy/DD/MM hh:mm");
try{
startTime = df.parse("04/30/06 10:30");
System.out.print ("Date: " + startTime)
}catch(ParseException e){
throw new IllegalArgumentException("Can't parse Start date");
}
//-------------------------------------------------------------------------
this code works fine when im using eng win2k and system locale = chinese taiwan.

but when i change the system locale to Thai, it shows the year is 2046, but my system clock still display 2004.


Please Help
Thanks
Lester
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But I got 1961, when I changed my locale setting to Thai... I think it's becos of the different usage of year in Thai Calendar...
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving this to the Intermediate forum...
 
Lester Tam
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can i fix it?
im doing a schedular tools and need it work it Thai Locale.

thanks
 
Lester Tam
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok finally i find out why, This year(2004) is 2547 in Thai.

but i dont know how to make sure my SimpleTimeFormat can always read the standard year not the system local
 
When you have exhausted all possibilities, remember this: you haven't - Edison. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic