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();