Hi all, I have a question concerning SimpleDateFormat. When I do:
I get: Wed Aug 21 13:34:00 CEST 2002 Mi, 21 Aug 2002, 13:34:00 Mi is 'Mittwoch' which is German for 'Wednesday'. I also suppose that the months are translated to German, as I am using the German time-settings. How can I get the date in the format Wed, 21 Aug 2002, 13:34:00 In short: I need to format Date(), but keep the English names. How can I do this? Thanks in advance Lisa Greetings from Germany !
You can create a Locale class object with language as English and use this Locale object in the Constructor of SimpleDateFormat class e.g Locale l= new Locale("en","DE"); SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy, HH:mm:ss",l); You can specify the required language and country code in the Locale constructor Veena
Joined: Aug 21, 2002
Hi Veena, thank you for your help, this did solve my problem. I guess SimpleDateFormat gets the systems country and language settings and formats the given date using these settings. Am I right? So, when I'm using e.g. English settings for country and language on my system I will get the English day-names without using the Locale object explicitly? Again, thanks for your help! Lisa
Originally posted by Lisa Drebendorf: I guess SimpleDateFormat gets the systems country and language settings and formats the given date using these settings. Am I right?
Yes. See java.util.Locale.getDefault() [ August 22, 2002: Message edited by: Ilja Preuss ]
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus