我是 C#.net 中的 Windows 窗体桌面应用程序。我保存了DateTime
SQL Server 数据库中的公历。现在我想显示DateTime
Shamsi (Jalali/Peersian) 日历格式 DataGridView
专栏。
如何显示波斯语 DateTime
在DataGridView
而数据库中的数据是公历DateTime
?
最佳答案
DateTime dt = DateTime.Now;
// Sets the CurrentCulture property to U.S. English.
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
// Displays dt, formatted using the ShortDatePattern
// and the CurrentThread.CurrentCulture.
Console.WriteLine(dt.ToString("d"));
// Creates a CultureInfo for German in Germany.
CultureInfo ci = new CultureInfo("de-DE");
// Displays dt, formatted using the ShortDatePattern
// and the CultureInfo.
Console.WriteLine(dt.ToString("d", ci));
你可以传递你自己的文化,我不确定你的文化代码是什么
关于c# - 如何在 DataGridView 中显示波斯日期时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40153594/