Results 1 to 3 of 3

Thread: listing second saturday

  1. #1

    Thread Starter
    Member essaar's Avatar
    Join Date
    Mar 2002
    Location
    India
    Posts
    40

    listing second saturday

    Hi all

    I need to list all the dates of second saturday for two months from the date entered by user as input.

    Does anyone know a short and quick method to accomplish this. there are many long methods but i need a short and simple one.

    bye

    A picture is worth a thousand words...and uses up a thousand times the memory.
    - essaar

  2. #2
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    If you would be using VBA-Excel, it would be real easy..(WEEKDAY -Function)
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  3. #3
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478
    Use the date functions

    This should put you on track
    VB Code:
    1. Public Function GetDays(dd As Date) As String
    2.    Dim iCount  As Integer
    3.    Dim iStart  As Integer
    4.    Dim d       As Date
    5.    Dim dStop   As Date
    6.    iStart = Weekday(dd, vbSaturday)
    7.    'goto next saturday
    8.    dStop = DateAdd("d", 8 - iStart, dd) ' we are at next saturday
    9.    dStop = DateAdd("ww", 2, dStop) ' added two weeks
    10.    dd = dStop  ' set a starting point
    11.    dStop = DateAdd("m", 2, dStop) ' set stop two months further in time
    12.    iStart = DateDiff("d", dd, dStop)
    13.    
    14.    For iCount = 1 To iStart
    15.       MsgBox DateAdd("d", iCount, dd)
    16.    Next
    17.    GetDays = dStop
    18. End Function
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

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