Results 1 to 4 of 4

Thread: datedifference inclusive

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2007
    Posts
    270

    datedifference inclusive

    how to include date inclusive b/w two dates

    i have

    Code:
     DateDiff(DateInterval.DayOfYear,date1,date2)
    i want if both date are same(say 12/2/2010,12/2/2010) it should give me 1 rather than 0 .

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: datedifference inclusive

    Use the DateInterval.Day


    Code:
    Dim dt1 As Date = "12/02/2010"
            Dim dt2 As Date = "12/02/2010"
            Dim diff As Integer = DateDiff(DateInterval.Day, dt1, dt2)
    Please mark you thread resolved using the Thread Tools as shown

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2007
    Posts
    270

    Re: datedifference inclusive

    it still gives 0 rather than1

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: datedifference inclusive

    Quote Originally Posted by dot_net_help View Post
    i want if both date are same(say 12/2/2010,12/2/2010) it should give me 1 rather than 0 .
    Why should it?!?

    If the dates are exactly the same, then the difference between them is 0.

    Gary

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width