Javascript validation

I want to validate this format 04/01/2014 01:30 if its type in and submitted.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

MrunalConnect With a Mentor Commented:
please refer below code:

    <p>Enter date</p>
    <input type="text" id="test1" value="02/05/2013 11:23"/>        
    <br /><br />
    <input type="button" id="btnSubmit" value="Submit" />

Open in new window

        if(validateDate($('#test1').val())) {
            $('#test1').css('background', '#0F0');
        } else {
            $('#test1').css('background', '#F00');

function validateDate(testdate) {
    var date_regex = /^\d{2}\/\d{2}\/\d{4}[ ]\d{2}[:]\d{2}$/ ;
    return date_regex.test(testdate);

Open in new window

smares323Author Commented:
great advice
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.