Results 1 to 10 of 10

Thread: [RESOLVED] DateDiff not working properly

Threaded View

  1. #1

    Thread Starter
    Addicted Member tgf-47's Avatar
    Join Date
    Feb 2010
    Location
    CapeTown, South Africa -34.01244,18.337415
    Posts
    209

    Resolved [RESOLVED] DateDiff not working properly

    I need to calculate the number of weeks between 2 dates. This will be used in a billing system.

    If something comes in on Thursday, they must get billed for that whole week.

    Here is my code that I tried. The code gives me wrong values. Only on the 3rd week, my week count is 1.
    vb.net Code:
    1. Private Function DIFF(ByVal THEDATE As Date)
    2.         Dim i As Integer
    3.         i = DateDiff("ww", THEDATE, Now.Date, FirstDayOfWeek.Monday)
    4.         Return i
    5.     End Function

    Honestly I cant see why this isn't working properly. Probably my lack of experience. Can anyone help me here?

    The code must be able to calculate the number of weeks between
    12/15/2008 - 30/10/2010 for example
    Last edited by tgf-47; Jul 7th, 2010 at 03:44 AM.

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