1
如何僅比較日期列表中的mounth和日期(不是年份)?檢查日期列表中是否存在日期
DateTime[] dates= new DateTime[]
{
new DateTime(DateTime.Now.Year, 1, 1),
new DateTime(DateTime.Now.Year, 5, 1),
new DateTime(DateTime.Now.Year, 5, 8)
};
// Result
DateTime date_1 = new DateTime(2016, 1, 1); // OK
DateTime date_2 = new DateTime(2022, 1, 1); // OK
DateTime date_3 = new DateTime(2016, 1, 2); // KO
DateTime date_4 = new DateTime(2016, 1, 3); // KO