//显示当前时间 private void button1_Click(object sender, EventArgs e) { this.dateTimePicker1.Format= DateTimePickerFormat.Custom; this.dateTimePicker1.CustomFormat = "yyyy-MM-dd HH:mm:ss"; this.dateTimePicker1.Value = DateTime.Now; }