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

  • Home
  • SEARCH
  • 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 7568287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:53:14+00:00 2026-05-30T14:53:14+00:00

I am trying to find the difference between two dates. The first of the

  • 0

I am trying to find the difference between two dates. The first of the two dates can be changed and when it is changed, the difference between the original dates has to be retained. This means that I have to automatically change the second date to have the same difference in days as it did before, but with a new first date.

Public Sub New()

    InitializeComponent()

    currDate = txt_ProjStart.Text

End Sub

Private Sub txt_ProjStart_TextChanged.....

If txt_ProjEnd.Text.Length > 0 Then

    Dim newDate As Date
    newDate = txt_ProjStart.Text




    Dim endDate As Date
    endDate = txt_ProjEnd.Text


End If

I have the value of the old date1(currDate) and the new date1 value(newDate). I need to get the difference between these, and then add or minus these days from the endDate.

Any help would be much appreciated! Thanks!

  • 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-05-30T14:53:16+00:00Added an answer on May 30, 2026 at 2:53 pm
    Dim newDate, endDate, someOtherDate As Date
    
    If Date.TryParse(txt_ProjStart.Text, newDate) AndAlso _
       Date.TryParse(txt_ProjEnd.Text, endDate) Then
    
        Dim diff As TimeSpan = endDate - newDate
        Dim result As Date = someOtherDate + diff
    End If
    

    Dates and TimeSpans convert into each other automatically. In addition, it would be a good idea to use a safe date conversion. TryParse will not generate an exception, if the date is invalid. Rather it will return False.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to find the difference between two NSDates. This worked once and printed
I'm trying to find out the difference between using one colon : and two
I am trying to find the difference between the following two sets: A =
I am trying to calculate the difference between given two times and i find
I am trying to find the difference between two generic lists, as in the
HI, I'm trying to use for loop to find the difference between every two
I have been trying to find out what the difference is between the IS
Trying to find an example that has css rollover using sprites & sliding door
I am trying to find the distance between two longitude and latitude points. I
I'm trying to find a good way to have version comparison between two files

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.