GridView中的日期时间格式 [英] Datetime format in gridview

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

问题描述

我在sql中有一个表,其日期为datetime格式.我想从该表中选择到GridView的数据.但是,而不是sql表中的日期"2012-05-30 00:00:00",它在gridview中显示为"2012-05-30 AM 12:00:00",因此我无法根据日期更新表格.我该怎么办?

I''m having a table in sql with date in datetime format. I want to select the data from this table to a gridview. But instead of the date ''2012-05-30 00:00:00'' in the sql table, it is displayed as ''2012-05-30 AM 12:00:00'' in the gridview so that i''m not able to update the table based on the date. What can I do for this?

推荐答案

DateTime格式在gridview列中 [ ^ ]
Asp.net C#中GridView ItemTemplate中的DateTime格式 [如何在GridView BoundColumn和TemplateColumn中格式化DateTime? [ GridView,DateTime,显示和排序 [
DateTime Format in gridview colum [^]
DateTime Format in GridView ItemTemplate In Asp.net C# [^]
How to format DateTime in GridView BoundColumn and TemplateColumn?[^]
GridView, DateTime, Display and Sorting[^]


请在网格列中尝试以下代码

< asp:boundfield datafield ="Fromdate" headertext ="Date" dataformatstring ="{0:MM/dd/yyyy}" xmlns:asp =#unknown">
please try below code in your grid column

<asp:boundfield datafield="Fromdate" headertext="Date" dataformatstring="{0:MM/dd/yyyy}" xmlns:asp="#unknown">


请参阅这些链接您可能会有所了解
http://peterkellner.net/2006/05/24/how-to-set-a-date-format-in-gridview-using-aspnet-20using-htmlencode-property/ [ http://forums.asp.net/t/1352728.aspx/1 [ ^ ]
see these link you may get some idea
http://peterkellner.net/2006/05/24/how-to-set-a-date-format-in-gridview-using-aspnet-20using-htmlencode-property/[^]

http://forums.asp.net/t/1352728.aspx/1[^]


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

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