SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript date validator.

    Is there any function in JavaScript which validates the date format like isNaN() for numbers? Or have anyone made such function which validates the date entered in the text box i.e. dd-mm-yyyy or yyyy-mm-dd or mm-dd-yyyy or dd/mm/yyy or mm/dd/yyyy or yyyy/mm/dd are only the valid dates??

    Thank you in advance.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    There are plenty of scripts if you look on Google

    They all base themselves on regular expressions. Have a look through those search results and I'm sure you'll find one, or you can build one from the regular expressions provided. Also remember to specify what format you want the user to enter the date in. Because then the regular expression may assume 09/04/2007 means the 9th of April while the user thinks they're entering the 4th of September.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •