View Full Version : validate a date
10-14-2006, 04:53 PM
what is the format of the date your users are inputting?
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.');
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.