我想把当前日期转换成:年月日的形式
(2005-9-20 10:42:40 转换成 2005年9月20日)

解决方案 »

  1.   

    now.tostring("yyyy年MM月dd日HH时mm分ss秒")
      

  2.   

    Dim T As String = "2005-9-20 10:42:40"
            MsgBox(CDate(T).Date)
      

  3.   

    1.
    <ASP:BOUNDCOLUMN  DATAFIELD=  "JoinTime  "  DATAFORMATSTRING=  "{0:yyyy-MM-dd}  "  >  
                 <ITEMSTYLE  WIDTH=  "18%  "  >  </ITEMSTYLE  >  
     </ASP:BOUNDCOLUMN  > 
    2.
    e.Item.Cell[0].Text  =  Convert.ToDateTime(e.Item.Cell[0].Text).ToShortDateString();
    3.
    String.Format(  "yyyy-MM-dd  ",yourDateTime);  4.
    Convert.ToDateTime("2005-8-23").ToString("yyMMdd",System.Globalization.DateTimeFormatInfo.InvariantInfo);5.
    <asp:BoundColumn DataField="收款时间" HeaderText="收款时间" 
         DataFormatString="{0:yyyy-mm-dd}">
    </asp:BoundColumn>
    6.
    DateTime.Now.ToString("yyyyMMddhhmmss")
      

  4.   

    this.Label1.Text=DateTime.Now.ToString("yyyy年MM月dd日");
      

  5.   

    now.tostring("yyyy年MM月dd日")