HuyPV
Friday, December 31, 2010
function isValidDate(d, m, Y) {
var arrDayInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
if (d < 1 || d > 31) return false;
if (m < 1 || m > 12) return false;
if (Y < 1) return false;
if (Y%100 == 0) {
if (Y%400 == 0) {
arrDayInMonth[1] = 29;
}
} else {
if (Y%4 == 0) arrDayInMonth[1] = 29;
}
if (d > arrDayInMonth[m-1]) return false;
return true;
}
Title:
Javascript Check is valid date
Description:
function isValidDate(d, m, Y) { var arrDayInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; if (d < 1 || d > 31) retur...
...
Rating:
4