datetimepicker怎么用,C#如何让DateTimePicker控件的日期居中显
1个回答
展开全部
先设置好dateTimePicker下面两个属性: dateTimePicker1.Format = DateTimePickerFormat.Custom; dateTimePicker1.CustomFormat = "yyyy-MM-dd HH:mm:ss";//HH是24小时,hh是12小时 然后用下面的方法就可以得到时,分,秒的值了: private void dateTimePicker1_ValueChanged(object sender, EventArgs e) { DateTime date = DateTime.Parse(dateTimePicker1.Text); string hours = date.Hour.ToString(); string minute = date.Minute.ToString(); string second = date.Second.ToString(); }
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询