c# - 如何在 DataGridView 中显示波斯日期时间

标签 c# sql-server datagridview gregorian-calendar persian-calendar

我是 C#.net 中的 Windows 窗体桌面应用程序。我保存了DateTime SQL Server 数据库中的公历。现在我想显示DateTime Shamsi (Jalali/Peersian) 日历格式 DataGridView专栏。

如何显示波斯语 DateTimeDataGridView而数据库中的数据是公历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/

相关文章:

sql - 如何过滤分组查询结果集(SQL)

sql - 使用条件设置行安全性

c# - 如何更改datagridview中的行颜色

sql - 如何使用日期时间作为字符串对datagridview进行排序

c# - 一次性使用模式

c# - 如何确定 Office 的 JavaScript API 版本号(适用于 Office 2013 项目的应用程序)

c# - 以编程方式使用 LowProfileImageLoader

sql-server - 如何在sql server中获取两个日期之间的当前月份名称,开始日期和结束日期

c# - 如何使用属性网格在 DataGridView 中实现多行标题?

c# - Word 自动化找出书签是否在表格中