Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

ok, I am being stupid!

I am doing a project plan and for each month I have the weeks 1-4.

My question is, how to know which week number a particular date belongs to?

I've played with outlook but it only displays week numbers for the whole year, which is no good.

Anyone know an online resource where I can just look back in the past and into future for week numbers for a month?

share|improve this question
add comment

4 Answers

Firstly, you should note that there are an average of 4 1/3 weeks per month. So if you use only 1-4 weeks, you will not be able to represent all the dates.

That aside, if you divide by 7 and round up, you get a week number between 1 and 5.

WeekNumber = Ceiling(DayofMonth / 7)

share|improve this answer
    
does day 7 belong to week 1 or week 2? i think the correct formula uses ceiling() (or upper(), same thing), not floor()+1. as another example, note Feb 28th is in week 5 according to this formula. –  quack quixote Mar 3 '10 at 11:38
    
Depends if it's been a long day in Australia or not :). You are indeed correct. Updated accordingly. –  Dan McGrath Mar 3 '10 at 11:45
add comment

Just look at the day of the month. Week number is upper(day_number / 7), i.e. you need to divide day number by 7 and round it to the next integer. Remember that there can be a 5th week too. For example March 31, belongs to week number 5.

This is rarely required, so I wasn't able to find any online resource, but have create such a plan on my own: http://spreadsheets.google.com/ccc?key=0AtS8km6a08YmdFFmVGdXdk8xR0tITk5mZ2ttaXI1bHc&hl=en

share|improve this answer
add comment

Is this what you are looking for,
If a month starts with last day of a week, then the second day of the month belongs to second week of the month....
Then try this,

temp = quotient(DayOfMonth/7)
if remainder(DayOfMonth/7) > DayOfWeek:
. . . WeekNumber = temp+1
else:
. . . WeekNumber = temp

This is just the logic....

share|improve this answer
add comment

Technically every calendar program supports a view called 'Month'. F.e. Sunbird will show the calendar in that view as five to six rows, with each representing a week:

this screenshot

However, I don't know what your project considers a week within a month.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.