string.format("{0,"yyyy-MM-dd"}",reader["BorrowDate"].ToString())

解决方案 »

  1.   

    tbBorrowDate.Text = string.Format("{0:yyyy-MM-dd}",reader["BorrowDate"].ToString()) 还是不行tbBorrowDate.Text = string.Format("{0,yyyy-MM-dd}",reader["BorrowDate"].ToString()) 出错
      

  2.   

    你要是还搞不定的话就用year,month,day把这三个分别取出来然后再用-连上,够笨的方法,但肯定好用,你也可以重写tostring
      

  3.   

    string.Format("{0:yyyy-MM-dd}",DateTime.Parse(reader["BorrowDate"].ToString()))
    or
    DateTime.Parse(reader["BorrowDate"].ToString()).Tostring("yyyy-MM-dd")
      

  4.   

    不要ToString()试试应该没问题
    tbBorrowDate.Text = String.Format("{0:yyyy-MM-dd}",reader["BorrowDate"])
    tbBorrowDate.Text = String.Format("{0:d}",reader["BorrowDate"])
      

  5.   

    string.Format("{0:yyyy-MM-dd}",DateTime.Parse(reader["BorrowDate"].ToString()))不要ToString()试试应该没问题
    tbBorrowDate.Text = String.Format("{0:yyyy-MM-dd}",reader["BorrowDate"])以上都可以,谢谢!!!