获取当月第一天和最后一天

来源:互联网 发布:火石软件官网 编辑:程序博客网 时间:2024/05/01 08:05

int year=DateTime .Now .Year ;
int month=DateTime .Now .Month ;
this.dtiFromTime.Value =new DateTime(year, month, 1); //显示当月第一天
this.dtiToTime.Value = new DateTime(year, month, DateTime.DaysInMonth(year, month));    //显示当月最后一天