在这里怎么写?
...
<asp:BoundField DataField="制定日期" DataFormatString="???"/>
...
 请问在"???"怎样写才能是日期格式变为:'2006-6-6'而不是'2006-6-6 10:12:12'

解决方案 »

  1.   

    http://zrlhappy.cnblogs.com/articles/361555.html
      

  2.   

    GridView的时间格式设置问题。 
      //GridView的时间设置问题。 
    1. 在GridView的编辑列窗口中,设置时间显示的格式为:{0:yyyy-MM-dd}。2. 在源码状态下,在该列的代码中加入该属性:HtmlEncode="false"。代码如下: <asp:BoundField DataField="UpdateTime" DataFormatString="[{0:yyyy/MM/dd}]" HeaderText="时间" HtmlEncode="false" SortExpression="UpdateTime">     <ItemStyle CssClass="STYLE2" Width="120px" HorizontalAlign="Right" />      <HeaderStyle Width="120px" Font-Size="Smaller" /></asp:BoundField>
      

  3.   

    试试:
    DataFormatString="{0:d}"
      

  4.   

    <asp:BoundField DataField="制定日期" DataFormatString="{0:d}"/>
      

  5.   

    可也用绑定列,读出时ToShortDateString()既可.
      

  6.   

    在存储过程中可以把该日期先转换后再绑定CONVERT(VARCHAR(10),日期字段,120) AS NewDate在你gridview里的BoundField 里绑定NewDate就可以了
      

  7.   

    DataFormatString="{0:d}"
    在编辑列里面也有对应的属性.
      

  8.   

    但是如果已转换成模板列的话,就需在HTML的代码中,找到要改的例,改里面的BIND()函数.