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
Printable View
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
If you would be using VBA-Excel, it would be real easy..(WEEKDAY -Function)
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