Article View: borland.public.jbuilder.java.language
Article #449Re: Newbie Date question (but trickier than it looks)
From: Gillmer J. Derge [TeamB]
Date: Mon, 03 Oct 2005 15:02
Date: Mon, 03 Oct 2005 15:02
21 lines
1696 bytes
1696 bytes
Hugh Jones wrote:
> So what I need to do is set the system level date format *At runtime*.
It's not clear what date format you're talking about, but I'm going to
assume you mean the one used by DateFormat.getInstance().
I don't think you can set the default date format directly, but as
you've discovered it's tied to the default locale, and you can set that.
Try something like this:
Locale klugedDateFormatLocale = new Locale("x", "y", "z");
Locale originalDefaultLocale = Locale.getDefault();
Locale.setLocale(klugedDateFormatLocale);
try {
// evil 3rd party API call
} finally {
Locale.setLocale(originalDefaultLocale);
}
--
Gillmer J. Derge [TeamB]
Technical Details
Message-ID:
<43414798$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<434142fe$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,597975fc8535d7af X-Google-Attributes: gidf74b3,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 03 Oct 2005 11:02:48 -0400 From: "Gillmer J. Derge [TeamB]" <spam@gillmerderge.com> User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: Newbie Date question (but trickier than it looks) References: <434142fe$1@newsgroups.borland.com> In-Reply-To: <434142fe$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.149.56.207 Message-ID: <43414798$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1128351640 24.149.56.207 (3 Oct 2005 08:00:40 -0700) Lines: 21 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail