• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic