Geekpedia Forums Logo

javascript datetime validation

by venkatesh padmanabhan on Friday, November 30th - 12:55 AM



Hi..

I have a javascript datetime picker calendar and a textbox in my web application. The user selects the datetime picker and uses the tab continuously. so at one point of time, there is no focus on the calender pick. Then the user clicks the enter button. The data which appears in the textbox is like this at this point of time: /11/2007 11:12:59

As you can see, the date is not present(only the month,year and the time is present).. I want to validate this.

How to check if the date time entered in the textbox is in proper format through javascript?

Please help

Hi,

There is no inbuilt method to check the date time format in Java script, So if you want to validate the date , you have to write the complete Java script code using substring function, comparison operator etc. Or you can validate the date on server side which is fairly simple.

Thanks
Vivek