Thanks:  0
Likes:  0
Dislikes:  0

# Thread: current week number of the month....

1. ## current week number of the month....

Is there any built in function or method for getting "current week number of the month" in vb? Looks like we only have week num of the year.

or should i calculate week num of the month from "week num of the year"?

Thanks

2. ## Re: current week number of the month....

Create a date const for jan 01
Use dateDiff function to get the number of days from Jan 01
Divide by 7
(Quotient + 1) is the current week of the year

3. ## Re: current week number of the month....

I am not looking for "current week of the year". I need to get "current week number of the month".

4. ## Re: current week number of the month....

[ QUOTE ]
I am not looking for "current week of the year". I need to get "current week number of the month".

[/ QUOTE ]

5. ## Re: current week number of the month....

For Aug 2008, 1st is Friday. So would 28th (today) be in 4th week or the 5th week (for your application) ?

If 4th week, just divide by 7(!!).

If 5th week, then get the day for 1st of the month, add the difference from monday.

e.g. today's 28th, and 1st was Friday (+4), makes it 32; divide by 7; get the quotient, add 1

Not that difficult, right???

6. ## Re: current week number of the month....

Thanks suchit

7. ## Re: current week number of the month....

For what it's worth, we ended up doing something similar but we used the datasheet and Excel to figure it out:
In cell A, we have the date =TODAY()
In cell B we have the day part =DAY(A1)
In cell C we divide B by 7 =B1/7
In cell D we rounded up =CEILING(C1,1) (this is the week of the month)

I have QTP making a selection based on cell D

8. ## Re: current week number of the month....

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.