Google Search: c# convert date from uk to usa

One of the searches that came from Google to my site asked the following "c# convert date from uk to usa".

Now I don't really know exactly what the user was asking for, but I presume it is something fairly simple. The way that I would convert a UK date into a US date is as follows.

Read in the UK date, short format/long format whatever into a DateTime field. The output the date time using a US locale.

The following code works in vs2005.

CultureInfo cultEnGb = new CultureInfo("en-GB");
CultureInfo cultEnUs = new CultureInfo("en-US");
DateTime dtGb = Convert.ToDateTime(textBox1.Text, cultEnGb.DateTimeFormat);
textBox2.Text = dtGb.ToString(cultEnUs.DateTimeFormat.ShortDatePattern);

It reads in the date and tries to load the text as a UK Date from the first textbox and then it uses the US locale to output the string into the second textbox.

Technorati Tags
[feed], [feed], [feed], [feed], [feed], [feed], [feed], [feed]

Related Wikipedia Documents
, , , , , , ,

My Related Documents
, ,

Related Amazon Books
The Game Localization Handbook: /, Internationalization and Localization Using Microsoft.NET: /, A Practical Guide to Software Localization: For Translators, Engineers and Project Managers (Language International World Dictionary, V. 3): /, Global Software: /, A Practical Guide to Software Localization: For Translators, Engineers and Project Managers (Language International World Diretory, 3): /, Programming for World Markets: A Guide to Software Internationalization: /

Related Images From Flickr
[[posterous-content:rwDJAafFbmzvsCeeezsC]][[posterous-content:dIbfysAdbiphphcxrsxm]][[posterous-content:nGfmmxpGFktuzvukBqDc]][[posterous-content:AijkBcetGigyHqwkBpDE]]