2 Replies - 308 Views - Last Post: 31 July 2012 - 12:08 AM Rate Topic: -----

#1 maiOHmai  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 86
  • Joined: 09-July 12

getting number of days between dates

Posted 30 July 2012 - 10:48 PM

im using this code to get the number of days between dates,

 Dim duedate As Date = dtpBorrow.Value
            Dim tsTimeSpan As TimeSpan
            Dim noOfDays As Integer
            tsTimeSpan = Now.Subtract(duedate)
            noOfDays = tsTimeSpan.Days
            txtFine1.Text = noOfDays.ToString()



my problem is that it produced a negative value.. how's that happened?
Is This A Good Question/Topic? 0
  • +

Replies To: getting number of days between dates

#2 nK0de  Icon User is offline

  • Catch me As Exception
  • member icon

Reputation: 204
  • View blog
  • Posts: 823
  • Joined: 21-December 11

Re: getting number of days between dates

Posted 30 July 2012 - 11:29 PM

what is the start date and the end date?
Was This Post Helpful? 0
  • +
  • -

#3 maiOHmai  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 86
  • Joined: 09-July 12

Re: getting number of days between dates

Posted 31 July 2012 - 12:08 AM

date start would be the duedate (dtpBorrow), and the enddate would be the current date..
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1