Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Week of year to full Year
December 8, 2003, 5:11 pm
rate this thread
I have populated a drop down list bor with all the saturdays over a short
of time like this.
<Option Value="49">06 December 2003</Option>
<Option Value="50">13 December 2003</Option>
When I submit the page I can retreve the Value 49 or 50 etc.
I need to either retreve the full date i.e. 06 December 2003 or
A function that can turn the value back from 49 to the full date.
Is there a way around this problem please.
Re: Week of year to full Year
Say you want to find out the beginning of week 49.
Step 0. n is 49.
n = 49
Step 1. Take the beginning of the year.
y = Format(Now(), "yyyy")
beginningOfYearString = "1/1/" & y & "00:00:00"
Step 2. Turn this from a String into a Date.
beginningOfYearDate = CDate(beginningOfYearString)
Step 3. Add on 49 Weeks. Depending on what you count as "week 1",
you may want to change 'n' to 'n+1' or 'n-1' or something.
wantedDate = beginningOfYearDate.AddDays(7 * (n))
Step 4. Go forward to the Saturday.
I think that should do what you want, but my VisualBASIC is a little rusty.
Toby A Inkster BSc (Hons) ARCS
Contact Me - http://www.goddamn.co.uk/tobyink/?page=132