string sdt ;
System.DateTime dt = System.DateTime.Now
sdt = dt.Year.ToString()+"."+dt.Month.ToString().PadLeft(2,'0')+"."+dt.Day.ToString().PadLeft(2,'0');

解决方案 »

  1.   

    System.DateTime.Now.Tostring("yyyy.M.d")
      

  2.   

    我在Load事件里写:
    this.dateTime_KFDate.Format =System.DateTime.Now.ToString("YY.MM.DD");
    可是为什么没有变化呢?
      

  3.   

    刚才笔误
    System.DateTime.Now.ToString("yyyy.MM.dd")
      

  4.   

    我在Load事件里写:
    this.dateTime_KFDate.Format =System.DateTime.Now.ToString("YY.MM.DD");
    可是为什么没有变化呢?
      

  5.   

    this.dateTime_KFDate.Format是什么控件阿?
      

  6.   

    this.dateTime_KFDate.Format =System.DateTime.Now.ToString("yy.MM.dd");
     注意,哪里是小写,哪里是大写。
      

  7.   

    xianfz(xianfeng)写得很清楚了。
    最好去查查csdn,找datetime.tostring();里面有各种参数的设置。
      

  8.   

    public void SetMyCustomFormat()
    {
       // Set the Format type and the CustomFormat string.
       dateTime_KFDate.Format = DateTimePickerFormat.Custom;
       dateTime_KFDate.CustomFormat = "yyyy.MM.dd";
    }