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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

weeks from year 1

Status
Not open for further replies.

discusmania

IS-IT--Management
Oct 24, 2000
158
AP
hello guys,

i want the script to be able to divide a year into weeks, for example divide this year to w1,w2,w3 until w52. how to do that?

Thanks so much
 
I'm afraid you're going to have to be a bit more specific, discusmania.

I can't get an idea of what you are trying to accomplish from the above post.

Please specify...
 
What i mean is the code will be able to read from calendar, if it's for example from monday to sunday , it will group in as w1, then the next monday to the next sunday will be w2 until end of the year. sorry, i just don't know how to explain in a rite word.

thanks so much for the reply.
 
Well, there is a dateDiff function... If I wanted to find out what week a date fell into, then I would probably do the following:
Code:
dim thisDate, weekNo
thisDate = 2/15/01
weekNo = dateDiff("WW", 1/1/01, thisDate)
Where the "WW" is the interval that you want returned (Week of the Year), so the resulting weekNo would hold an integer value telling you what week of the year that the thisDate would fall into relative to the first date...

Let me note that I haven't actually used the "WW" interval, so although I think that's what it does, if it doesn't return the value you want, then plug in "D" (will definitely return the number of days passed), and then divide the resulting value into 7 to get the number of weeks that have passed (you could put the final calculation into a cInt operation to get the integer value with no decimal points)

Is that even close to what you meant???


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top