0

i want to add dates from two datetimepicker...for example the user chooses the date 1/1/2012 in the first picker and chooses 1/3/2012 in the second picker the answer should be 3 that will be shown in a textbox..
this is the codes that i tried:

 Dim dt1 As Date = Date.Parse(fromdatepicker.Text)
    Dim dt2 As Date = Date.Parse(todatepicker.Text)

    daysTB.Text = Math.Abs(CInt(dt2.Subtract(dt1).TotalDays))

that code gives me the answer of 2 which is not correct..please help me with this

2
Contributors
2
Replies
4
Views
4 Years
Discussion Span
Last Post by jhedonghae
0

The answer will be 2 only since subtracting higher to lower will give the result...if u want all the days inclusive just add 1 to ur result...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.