Question problem to find 2nd & 4th saturdays in a month

swethajain

Well-known member
Joined
Feb 1, 2010
Messages
48
Programming Experience
Beginner
Hi,
I have an application in which when the application opens it will check whether the employees have updated the task sheet yesterday and while closing it will check whether they have updated today. Problem is when the application runs on monday it will check for sunday. how can i resolve these holidays problem?

Thanks,
Swetha.
 
VB.NET:
Dim previous As Date = Date.Today.AddDays(-1)
If previous.DayOfWeek = DayOfWeek.Sunday Then
    previous = previous.AddDays(-1)
End If
 
You can for example start with first day of month, AddDays(1) until first Saturday. AddDays(7) from that is second Saturday. AddDays(14) from that is fourth Saturday.
 
Back
Top