Week of year to full Year

O

Otuatail

Can anyone tell me if this is possible.
I have populated a drop down list bor with all the saturdays over a short
period
of time like this.
<SELECT Name="SelectedWeek">
<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.


Paul.
 
W

William Tasso

Otuatail said:
Can anyone tell me if this is possible.
I have populated a drop down list bor with all the saturdays over a
short period
of time like this.
<SELECT Name="SelectedWeek">
<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.

<option value="06 December 2003">06 December 2003</option>
 
T

Toby A Inkster

Otuatail said:
A function that can turn the value back from 49 to the full date.

What William said is probably what you want, but if you do need to turn
back 49 into the date, which server-side scripting language are you using?
 
T

Toby A Inkster

Otuatail said:
I am using VB Script. The only one
that I know I am A vb Programmer.

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.

While Weekday(wantedDate)
wantedDate.AddDays(1)
Wend

I think that should do what you want, but my VisualBASIC is a little rusty.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top