By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,724 Members | 859 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,724 IT Pros & Developers. It's quick & easy.

Convert a Number to Years and Weeks only

P: n/a
Hi,
Is there a code that converts a whole number to Years and Weeks only?

Thanks,
Bull

Oct 2 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Oct 1, 11:20 pm, Bull <MrsFore...@gmail.comwrote:
Hi,
Is there a code that converts a whole number to Years and Weeks only?

Thanks,
Bull
Your question makes as much sense as converting a whole number to
apples. However, if you want to add weeks and years to a date, you
could use the following.

newDate=DateAdd("w",years*52+weeks,oldDate)

Oct 2 '07 #2

P: n/a
Try this if you just want to have a function that gives you the week
number for a particular date, and the second function returns you just
the year...

Function VBAWeekNum(D As Date, FW As Integer) As Integer
VBAWeekNum = CInt(Format(D, "ww", FW))
End Function

Function VBAYear(D As Date) As Integer
VBAYear = CInt(Format(D, "YYYY"))
End Function

Quick and easy :-)

Cheers

The Frog

Oct 4 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.