Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21238

ISO Absolute Week !

$
0
0
Hello guys,

I am stuck in an elementary problem...I found on the Chip Pearson's site a very simple formula to calculate the absolute week number in a year :
Code:

Sub myTest()
    Dim absWeek As Byte
    absWeek = DatePart("ww", Calendar1, vbMonday, vbFirstFourDays) 'Absolute Week
End Sub

After a few tests I considered that this formula is stable enough and the number of weeks in a year could be either 52 or 53.
My issue is I would like to get, for a given absolute week, the first day of that week (which is, of course, a Monday). The result should be in the following format : dd/mm/yyyy.
For example, let's say that a week number for the last year (2012) is 51. Putting as parameters 51 and 2012 in a formula (or function) we should obtain 17/12/2012...
It seems simple but how could I extract the date part of the beginning of that week ? Thank you in advance for any help.

Daniel

Viewing all articles
Browse latest Browse all 21238

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>