C#判断年月日是否合法
static bool ValidateDate(int y, int m, int d) { int[] a = { 31, (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; return m >= 1 && m <= 12 && d >= 1 && d <= a[m - 1]; }
C#判断年月日是否合法
static bool ValidateDate(int y, int m, int d) { int[] a = { 31, (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; return m >= 1 && m <= 12 && d >= 1 && d <= a[m - 1]; }