CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 1999
    Location
    Sweden
    Posts
    33

    looping in dates

    Hi!
    I have a startdate and stopdate in datetype and I want to "loop" through it and select specific weekdays - say for example all sundays.
    Does anyone know how to do that?
    Thanks
    Jen


  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: looping in dates

    Here's an example using the VB 'WeekDay' command :


    Dim dteOne as date
    Dim dteTwo as date
    Dim lCount as Long

    dteOne = #12/25/1999#
    dteTwo = #1/1/2000#

    for lCount = dteOne to dteTwo
    If Weekday(lCount) = vbSunday then
    Debug.print CDate(lCount); " = Sunday"
    End If
    next





    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

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

Featured