|
-
May 6th, 2003, 02:39 AM
#1
Thread Starter
Member
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
-
May 6th, 2003, 03:01 AM
#2
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!
-
May 6th, 2003, 03:16 AM
#3
Frenzied Member
Use the date functions
This should put you on track
VB Code:
Public Function GetDays(dd As Date) As String
Dim iCount As Integer
Dim iStart As Integer
Dim d As Date
Dim dStop As Date
iStart = Weekday(dd, vbSaturday)
'goto next saturday
dStop = DateAdd("d", 8 - iStart, dd) ' we are at next saturday
dStop = DateAdd("ww", 2, dStop) ' added two weeks
dd = dStop ' set a starting point
dStop = DateAdd("m", 2, dStop) ' set stop two months further in time
iStart = DateDiff("d", dd, dStop)
For iCount = 1 To iStart
MsgBox DateAdd("d", iCount, dd)
Next
GetDays = dStop
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|