Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting date?

Status
Not open for further replies.

savok

Technical User
Jan 11, 2001
303
AT
How would i go about getting the date of the first friday of the year if I had the year?

Lets say I had 1996, what function can i use to get the date of the first friday on that year? Which should be January 5th


thanks!
 
You can use the weekday function:
Dim adate As Date
Dim ayear As Integer
ayear = 2002
adate = "01-01-" & ayear
Do While Weekday(adate, vbSunday) <> 6
adate = adate + 1
Loop
MsgBox adate


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top