如何在datagridview列中显示日期和时间 [英] how to display date and time in datagridview column

查看:421
本文介绍了如何在datagridview列中显示日期和时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在datagridview列中同时显示时间和日期.同时它也应该是可编辑的.我尝试使用MSDN链接中提供的代码.但只显示日期.它显示的时间为12:00,并且不可编辑.我使用的代码在下面给出

http://msdn.microsoft.com/en-us/library/7tas5c80.aspx [ ^ ]

但是这段代码我只能检索日期信息

I want to display both time and date in datagridview column .at the same time it should be editable also.I tried with the code provided in MSDN link. but it shows the date only. it shows time as 12:00 and it is not editable too. the code which i used is given below

http://msdn.microsoft.com/en-us/library/7tas5c80.aspx[^]

but this code i am able to retrieve only date information

推荐答案

请设置列格式为yyyy/MM/dd HH:mm
Please set the format to your column to yyyy/MM/dd HH:mm


如何:在Windows窗体DataGridView控件中设置数据格式
[^ ]

如何:在Windows窗体DataGridView控件中自定义数据格式
[^ ]
How to: Format Data in the Windows Forms DataGridView Control
[^]

How to: Customize Data Formatting in the Windows Forms DataGridView Control
[^]


这篇关于如何在datagridview列中显示日期和时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆