Web Analytics Made Easy -
StatCounter validate a date - CodingForum

Announcement

Collapse
No announcement yet.

validate a date

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • validate a date

    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

  • #2
    what is the format of the date your users are inputting?

    Comment


    • #3
      Use the date object:

      Code:
      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.');
      }

      Comment

      Working...
      X