开发者

.NET - How can I change the Date format by creating a new Culture in .NET?

My code is like this:

CultureAndRegionInfoBuilder cib = new CultureAndRegionInfoBuilder("eh-sim"开发者_Go百科, CultureAndRegionModifiers.None);
cib.LoadDataFromCultureInfo(new CultureInfo("en-us"));
cib.LoadDataFromRegionInfo(new RegionInfo("US"));
cib.CultureEnglishName = "Versão de teste";
cib.NumberFormat.CurrencyDecimalSeparator = "   ";

cib.Register();
CultureInfo ci = new CultureInfo("eh-sim");
Thread.CurrentThread.CurrentCulture = ci;
Console.WriteLine("EnglishName:. . . . . . . . . . {0}", ci.EnglishName);
Console.WriteLine(123.456.ToString("C"));
Console.ReadKey();

I want to the date format be for example: 10//12//10


You need to set the cib.GregorianDateTimeFormat to a suitable DateTimeFormatInfo that has the DateSeparator you want (//).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜