How to set culture in the application?

T

Tsair

I would like to use the date format as dd/mm/yyyy, normaly i have to set the
Windox XP culture info. How to set the application culture to the format i
need winthout change the Windox XP setting ?

Thanks.
 
M

Morten Wennevik

Hi Tsair,

Use the CultureInfo class. Change the CultureInfo in the CurrentThread class

System.Threading.Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture("en-US");
label1.Text = DateTime.Now.ToString();

Store the CultureInfo reference before changing it if you need to change it back to the original.
 
N

Nick Hounsome

Tsair said:
I would like to use the date format as dd/mm/yyyy, normaly i have to set
the Windox XP culture info. How to set the application culture to the
format i need winthout change the Windox XP setting ?

Thanks.

IMHO it is always wrong to mess with cultures.
If you really must have a specific format then format the dates explicitly.
You should then provide the user with the option to specify what format HE
wants...oh the culture already does that!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top