string.Format("{0:d}",ds.Tables["srcTable"].Rows[i]["ExamTime"])

解决方案 »

  1.   

    try something like<%# Convert.ToDateTime(DataBinder.Eval
    (Container.DataItem, "LastModifiedDate")).ToString("yyyy-MM-dd") %>
      

  2.   

    用Format函数,这个方法是专门格式化的,可以把字符串中的内容变成你希望的格式,如日期,数字格式,小数及货币格式等。
    你打开Vs.net,在搜索里面查找Format方法就行了。
    具体VS.net帮助地址:
    ms-help://MS.VSCC/MS.MSDNVS.2052/vblr7/html/vafctformat.htm还有就是预定义的格式内容:
    ms-help://MS.VSCC/MS.MSDNVS.2052/vblr7/html/vafmtnameddateformats.htm根据你的问题,一个简单的例子(VB代码):
    首先定义一个字符串
    Dim strDate As String
    然后赋值
    strDate=Now()
    然后进行转换。
    strDate=Format(strDate,D)就行了!!