我现在转换了dateTimePicker显示为时间格式,但是dateTimePicker默认显示为“00:00:00”;那位大侠帮哈忙!下面是时间格式代码:
this.timePicker2.Format = DateTimePickerFormat.Time;
this.timePicker2.ShowUpDown = true; 

解决方案 »

  1.   

    你改成这样
                  this.dateTimePicker1.Format = DateTimePickerFormat.Custom;
                this.dateTimePicker1.ShowUpDown = true;
                this.dateTimePicker1.CustomFormat = DateTime.Now.ToLongTimeString();
      

  2.   

    你设置value的值就行了
    如果不设置,默认是获取系统时间
      

  3.   

    this.dateTimePicker1.CustomFormat = "00:00:00";
      

  4.   

    this.timePicker2.Format = DateTimePickerFormat.Time; 
    this.timePicker2.Value  = DateTime.Today;
    // 或:
    this.timePicker2.Value  = this.timePicker2.Value.Date;
      

  5.   


        this.timePicker2.Value = new DateTime(2009,5,5,0,0,0); 这个没错了撒,但还是不行! 谢谢!
      

  6.   

    this.dateTimePicker1.Format = DateTimePickerFormat.Time;
    this.dateTimePicker1.ShowUpDown = true; 
    dateTimePicker1.Value =Convert.ToDateTime("00:00:00");
      

  7.   

    this.timePicker2.Format = DateTimePickerFormat.Time; 
    this.timePicker2.Value  = DateTime.Today;
    // 或:
    this.timePicker2.Value  = this.timePicker2.Value.Date;正解
      

  8.   

    你是想实现怎样一个效果?
    试试这个this.dateTimePicker1.CustomFormat = "yyyy-MM-dd 00:00:00";
      

  9.   

    默认显示 00:00:00
     this.dateTimePicker1.Value = new System.DateTime(2009, 5, 31, 0, 0, 0, 0);