/// <summary> /// 获取选中时间 /// </summary> private void GetSelectTime() { //今日 if (rbToday.Checked == true) { dtpBeginTime.ReadOnly = true; dtpEndTime.ReadOnly = true; dtpBeginTime.Value = Convert.ToDateTime(DateTime.Now.ToString("D").ToString()); dtpEndTime.Value = Convert.ToDateTime(DateTime.Now.AddDays(1).ToString("D").ToString()).AddSeconds(-1); } //本周 else if (rbWeek.Checked == true) { dtpBeginTime.ReadOnly = true; dtpEndTime.ReadOnly = true; dtpBeginTime.Value = GetThisWeekMonday(); dtpEndTime.Value = Convert.ToDateTime(DateTime.Now.AddDays(1).ToString("D").ToString()).AddSeconds(-1); } //自定义时间 else if (rbCustomize.Checked == true) { dtpBeginTime.ReadOnly = false; dtpEndTime.ReadOnly = false; } }