Datagridview格式日期单元格 [英] Datagridview format date cell

查看:92
本文介绍了Datagridview格式日期单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用这个

i use this

dataGridView1.Columns.Add("Order_date", "Order date");







dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["Order_date"].Value = reader[5].ToString();



如何格式化日期?


how to format date ?

推荐答案

this将帮助...



this will help...

reader Value type shoul be in DateTime Format
DateTime thisDate1 = new DateTime(2011, 6, 10);
//Console.WriteLine("Today is " + thisDate1.ToString("MMMM dd, yyyy") + ".");

dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["Order_date"].Value = reader[5].ToString("MMMM dd, yyyy");







更多细节请访问这里....





http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx [ ^ ]


检查此链接以将DataGridview Date Column格式化为指定的日期格式。



希望这可以解决问题。



http://stackoverflow.com/questions/10644788/c-sharp-datagridview-date -time-a-column [ ^ ]
Check this link to format DataGridview Date Column to specified Date Format.

Hope this solves the problem.

http://stackoverflow.com/questions/10644788/c-sharp-datagridview-date-time-formatting-of-a-column[^]


check 这个,可能会有所帮助。
check this out, it may be helpful.


这篇关于Datagridview格式日期单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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