Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7816507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:53:34+00:00 2026-06-02T05:53:34+00:00

i want to find find differences between two dates, where m giving date value

  • 0

i want to find find differences between two dates, where m giving date value in the text box and i want the differences/duration to some other textbox.

 <script language=javascript>
        function formshowhide(id) {
      if (id == "other") {
          //document.getElementById('quotef').style.display = "block";
          document.getElementById('otherf').style.display = "block";

     //here m writng the function for finding duration
          var txtdate1 = document.getElementById('MainContent_txtOStartDate').value;
          var txtdate2 = document.getElementById('MainContent_txtOEndDate').value;
          var date1 = new Date(txtdate1.split('-')[0], txtdate1.split('-')[1] - 1, txtdate1.split('-')[2]);
          var date2 = new Date(txtdate2.split('-')[0], txtdate2.split('-')[1] - 1, txtdate2.split('-')[2]);
          var timediffsec = date2.getTime() - date1.getTime();
          var timediffday = parseInt(timediffsec / (24 * 3600 * 1000));
          document.getElementById('MainContent_txtDays').value = timediffday;
     //here the function end for finding the duration
      }
      else {
          // document.getElementById('quotef').style.display = "none";
          document.getElementById('otherf').style.display = "none";
      }
  }
  </script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T05:53:35+00:00Added an answer on June 2, 2026 at 5:53 am
    // Assuming you already have validation on the date input text boxes
    DateTime startDate = Convert.ToDateTime(txtOStartDate.Text);
    DateTime endDate = Convert.ToDateTime(txtOEndDate.Text);
    TimeSpan timeDiff = startDate - endDate;
    

    Then you can display whatever you want from the timespan:

    string.Format("{0} days, {1} hours and {2} minutes.", timeDiff.Days, timeDiff.Hours, timeDiff.Minutes);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to find out the difference between two Dates (in terms of minutes)
If I want find the differences between two directory trees, I usually just execute:
I want to find time difference between two date and then compare the difference
I am not able to find actual differences between these two Java EE servers.
I want to find difference between two time-components, but I am not getting what
Let's say I want to find out the difference in seconds between two times.
I want to find a date after a give weeks(months). For example, I want
Possible Duplicate: How to calculate the difference between two dates using PHP? How to
Is there any way find difference between two cs files. I already ask question
I want to install svn repository. Is there any differences between Subclipse and Subversion?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.