int m=System.DateTime.DaysInMonth(System.DateTime.Now.Year,System.DateTime.Now.Month);
int m=System.DateTime.DaysInMonth(System.DateTime.Now.Year,System.DateTime.Now.Month); dateTimePicker1.Value =Convert.ToDateTime(System.DateTime.Now.Year+"-"+System.DateTime.Now.Month+"-"+m);
using System; int y = DateTime.Today.Year; int m = DateTime.Today.Month; int d = DateTime.DaysInMonth(y, m); dateTimePicker1.Value = new DateTime(y, m, d); 这样当然可以,但一楼的方法更巧妙。
dateTimePicker1.Value =Convert.ToDateTime(System.DateTime.Now.Year+"-"+System.DateTime.Now.Month+"-"+m);
int y = DateTime.Today.Year;
int m = DateTime.Today.Month;
int d = DateTime.DaysInMonth(y, m);
dateTimePicker1.Value = new DateTime(y, m, d);
这样当然可以,但一楼的方法更巧妙。