mikechandler
07-27-2004, 11:51 AM
I am building an ASP.NET server control in C#, and I need the control to convert a DateTime variable into a string, using the date format set by the user in Regional Settings. So far I have tried:
protected System.IFormatProvider format;
format = new CultureInfo(CultureInfo.CurrentCulture.Name,true);
...and then further down....
datestring = Convert.ToString(new DateTime(thisyear,thismonthnumber,day),format);
However it always seems to use the "en-GB" format even when I specify English-US in Control Panel's Regional Settings. Any ideas why this is happening?
Any advice would be much appreciated, cheers
Mike
protected System.IFormatProvider format;
format = new CultureInfo(CultureInfo.CurrentCulture.Name,true);
...and then further down....
datestring = Convert.ToString(new DateTime(thisyear,thismonthnumber,day),format);
However it always seems to use the "en-GB" format even when I specify English-US in Control Panel's Regional Settings. Any ideas why this is happening?
Any advice would be much appreciated, cheers
Mike