Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to compare two dates using Javascript

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 457
    Comment on it

    On using the javascript technology you can perform the comparison operation very quick in real time. In this case we will see how to compare two given date:-

    var DateOne = "1991-10-10".split('-');
    var DateTwo = "2005-09-01".split('-');
    
     var firstDate=new Date();
     DateOne.setFullYear(firstValue[0],(firstValue[1] - 1 ),firstValue[2]);
    
     var secondDate=new Date();
     DateTwo.setFullYear(secondValue[0],(secondValue[1] - 1 ),secondValue[2]);     
    
      if (firstDate > secondDate)
      {
       alert("First Date  is greater than Second Date"); //your output
      }
     else
      {
        alert("Second Date  is greater than First Date"); //your output
      }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: