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
    18,253
    Thanks
    203
    Thanked 2,557 Times in 2,535 Posts
    You will find the solution at
    http://www.codingforums.com/showthread.php?t=121


  •  

    Posting Permissions

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