不能使用dataformatstring格式化日期时间

编程入门 行业动态 更新时间:2024-10-10 08:26:07
本文介绍了不能使用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:00AM

I 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格式化日期时间

本文发布于:2023-11-05 10:00:59,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:日期   时间   dataformatstring

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!