























Sometimes we need to get local machine date format string.Example The User tell us they want to see the date has same format as their compute.
I spent some time to find the method by using Google,but I failed. At last I found the way by myself.And below is my method.
CultureInfo cultureInfo=CultureInfo.CurrentCulture;
string localMachineShortDateFormat=cultureInfo.DateTimeFormat.ShortDatePattern;
Finally I found a very very easy way
DateTimeFormatInfo.CurrentInfo.ShortDatePattern
And I got some useful code.
CultureInfo currCI = System.Threading.Thread.CurrentThread.CurrentCulture;
CultureInfo engCI = new CultureInfo("en-US",false);
System.Threading.Thread.CurrentThread.CurrentCulture = engCI;
And I got some puzzles too.
CultureInfo destCI = System.Threading.Thread.CurrentThread.CurrentCulture;
CultureInfo osCI = System.Globalization.CultureInfo.InstalledUICulture;
CultureInfo overrideCI = LanguageManager.SystemCultureInfo;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。