【问题标题】:Datagridview format datetime to translateDatagridview 格式日期时间进行翻译
【发布时间】:2017-07-13 12:44:16
【问题描述】:

enter image description here

当我将 excelden 文件上传到 Windows 时,日期字段看起来像一个整数。

当我在不使用数据库的情况下将 Excel 文件上传到 Windows 窗体时,日期字段看起来像一个整数。

如何将我的日期字段转换为 DataGridView 中的确切日期格式? Defaultcellstyle.format = "dd / MM / yyyy" 我要改一下文义。

【问题讨论】:

    标签: c# excel datetime datagridview


    【解决方案1】:

    改变格式字符串如下

    Defaultcellstyle.format = "{0:dd/MM/yyyy}"
    

    【讨论】:

      【解决方案2】:

      enter image description here我尝试了你在截图中指定的代码,但我转向了我发送的格式。

      代码:dataGridView1.Columns[0].DefaultCellStyle.Format = "{0:dd/MM/yyyy}";

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-05-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-09-09
        相关资源
        最近更新 更多