I've been given two dates that takes their values from two respective dtpickers.
I've got to calculate the exact amount of days, months and years between them.
So I tried this:
Dim dteStartDate As Date
Dim dteEndDate As Date
dteStartDate = dtpStart.Text
dteEndDate = dtpEnd.Text
dteResultDays = DateDiff(DateInterval.Day, dteStartDate, dteEndDate)
dteResultMonths = DateDiff(DateInterval.Month, dteStartDate, dteEndDate)
dteResultYears = DateDiff(DateInterval.Year, dteStartDate, dteEndDate)
The problem is that this method gives me ALL of the amount of respective days, months and years passed, but I need to split them in the correct way. Ex, between 28/2/98 and 13/1/2007 the result should be 15 days, 10 months and 8 years. And above all, another bug is that the function indicates one month more (or one year more) with only one day (or month) passed between the two dates! They told me I shoul use TimeSpan,but i don't Know how...
Any brighter ideas? I'd be very grateful...and it will grant you an excellent karma :-)