Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2005
    Location
    Bangalore,India
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Finding Date difference between two dates

    How to compare two dates in Java script.
    I need to find the difference between two dates.
    Although i have found a method on this site but I am not sure about this whether it is right or not.
    Because this logic fails for some values.

    sysdate= Date.parse(date2,month2,year2);
    entereddate= Date.parse(date1,month1,year1);
    defauldate=Date.parse(defaultdate);

    alert(sysdate);
    alert(entereddate);
    alert(defauldate);
    alert((sysdate-entereddate)/(24*60*60*1000));
    alert((entereddate-defauldate)/(24*60*60*1000));

    Please reply back in anyone finds the answer.

    Regards,
    Deepak

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,730
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    You will find the solution at
    Calculate the difference btw 2 dates


  •  

    Posting Permissions

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