...

View Full Version : validate a date



yen
10-14-2006, 04:12 PM
i got one text box..is let the user enter the borrow date using a javascript calendar. how to i block the user to enter the date earlier than today date?using the javascript?i mean...if the user enter date that earlier than today...got one alert message....plz help..
thanx

boeing747fp
10-14-2006, 04:53 PM
what is the format of the date your users are inputting?

Beagle
10-14-2006, 08:51 PM
Use the date object:



var todayInMillisecond = (new Date()).getTime();
var theirInput = prompt('Gimme a date, man!');
if (todayInMillisecond > Date.parse(theirInput))
{
alert('Whoa there, time traveller, come on back to the future.');
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum