How do I covert a week # to a Friday's date in a mm/dd/yy format?

Z

zieki

I have the dates coverted to week numbers so I can compare last year's data
to this year's data. But now, for some new reports I'm creating, I need to
convert a week number to a Friday's date.
i.e. Week 2 = 1/14/2005
please email me at (e-mail address removed)
 
T

Tim Ferguson

I have the dates coverted to week numbers so I can compare last year's
data to this year's data. But now, for some new reports I'm creating,
I need to convert a week number to a Friday's date.
i.e. Week 2 = 1/14/2005

It seems that everyone and his dog has a different algorithm for defining
weeknumbers, but this one seems to work for the n'th Friday after
01/01/xxxx --

Public Sub Friday(WeekNum As Integer, YearNum As Integer)

Dim dtTemp As Date
Dim wOffset As Integer

wOffset = Weekday(DateSerial(YearNum, 1, 1))
If wOffset = 7 Then wOffset = 0

dtTemp = DateSerial(YearNum, 1, 7 * WeekNum - wOffset)

Debug.Print Format(dtTemp, "dddd, dd/mm/yyyy")

End Sub


Hope it helps


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top