Groups | Blog | Home
all groups > dotnet internationalization > december 2006 >

dotnet internationalization : How to display dates according to culture


Meena
12/14/2006 12:00:00 AM
I have set the culture for my form using
Thread.CurrentThread.CurrentUICulture
I have to display a date according to the format of the current culture.
When I display the date there seems to be no difference for ar-DZ and el-GR
culture.
How do I display the date according to the format my
culture.
Any help would be really useful.

Regards
Meena

Mihai N.
12/14/2006 8:57:54 PM
"Meena" <meena@chellasoft.com> wrote in
news:eaUID02HHHA.1784@TK2MSFTNGP06.phx.gbl:

[quoted text, click to view]
Date/time/number formats are affected by CurrentCulture.
CurrentUICulture is used to decide the language of the UI for a localized
application.


--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Meena
12/15/2006 12:00:00 AM
Isn't it possible to change the date format according to the
CurrentUICulture???
Only if I set the current culture using
Thread.CurrentThread.CurrentCulture
can the date format be changed for the culture setting????

Regards
Meena.

[quoted text, click to view]

Mihai N.
12/15/2006 7:35:28 PM
[quoted text, click to view]
No. And it is not recomended.

[quoted text, click to view]
Yes. CurrentCulture and CurrentUICulture have different roles.

CurrentCulture decides formatting, CurrentUICulture decides UI language.
Sure, you can set CurrentCulture to have the same value as CurrentUICulture.
But it might be confusing for the user.
Windows itself has different settings for the formatting
(Control Panel -> Regional and Language Options -> Tab1: Regional Options)
The "Standards and formats" determines the user locale for nls
(CurrentCulture for .NET). If you have MUI installed, in the second tab
(Languages) you will have an option called "Language used in menus and
dialogs." That is the UI locale for nls (CurrentUICulture for .NET)
So, as a user I expect the UI and formatting not to match.

Let me give you a good reason for that: most applications are not localized
in all the locales (there are 6 French locales, 5 German, 13 English, 19
Spanish). A user in U.K. wants to set his date/time/formats according to
the English U.K. rules, even if the UI is English U.S.


--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
AddThis Social Bookmark Button