DateTime today = DateTime.Now; // 获取今天的日期 DateTime yesterday = today.AddDays(-1); // 获取前一天的日期 DateTime nextYearYesterday = yesterday.AddYears(1); // 在昨天的日期上加一年 dPicker_start_time.Text = today.ToShortDateString(); dPicker_end_time.Text = nextYearYesterday.ToShortDateString();
DateTime today = DateTime.Now; // 获取今天的日期
DateTime yesterday = today.AddDays(-1); // 获取前一天的日期
DateTime nextYearYesterday = yesterday.AddYears(1); // 在昨天的日期上加一年
dPicker_start_time.Text = today.ToShortDateString();
dPicker_end_time.Text = nextYearYesterday.ToShortDateString();