本文介绍了不能使用dataformatstring格式化日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
出于某种原因,我无法在gridview中格式化我的日期文本
< asp:BoundField DataField = deptdateHeaderText =出发日期dataformatstring ={0:ddd,MM / d / yyyy}htmlencode =FalseSortExpression =deptdate/> 我仍然得到: 2011年5月10日上午12:00我没有将我的字段设置为数据库中的日期时间... DOY
peterkellner/2006/05/24/how-to-set-a-date-format-in-gridview -using-aspnet-20using-htmlencode-property /
< asp id =GridView1runat =服务器:GridView> <栏> < asp headertext =CreationDatedataformatstring ={0:M-dd-yyyy} datafield =CreationDate:BoundField HtmlEncode =false/> < / columns>
For some reason i can not format the text of my date in a gridview
<asp:BoundField DataField="deptdate" HeaderText="Departure Date" dataformatstring="{0:ddd, MM/d/yyyy}" htmlencode="False" SortExpression="deptdate" /> I still get this: May 10 2011 12:00AMI DID NOT SET MY FIELD TO DATETIME IN THE DATABASE...DOY
解决方案Have you tried this approach?
peterkellner/2006/05/24/how-to-set-a-date-format-in-gridview-using-aspnet-20using-htmlencode-property/
<asp id="GridView1" runat="server" :GridView> <columns> <asp headertext="CreationDate" dataformatstring="{0:M-dd-yyyy}" datafield="CreationDate" :BoundField HtmlEncode="false" /> </columns>
更多推荐
不能使用dataformatstring格式化日期时间
发布评论