Week of year to full Year

Discussion in 'HTML' started by Otuatail, Dec 8, 2003.

  1. Otuatail

    Otuatail Guest

    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.
     
    Otuatail, Dec 8, 2003
    #1
    1. Advertising

  2. Otuatail wrote:
    > 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>

    --
    William Tasso - http://WilliamTasso.com
     
    William Tasso, Dec 8, 2003
    #2
    1. Advertising

  3. Otuatail wrote:

    > 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?

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
     
    Toby A Inkster, Dec 8, 2003
    #3
  4. Otuatail

    Otuatail Guest

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

    Paul.
     
    Otuatail, Dec 8, 2003
    #4
  5. Otuatail wrote:

    > 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.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
     
    Toby A Inkster, Dec 8, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    3
    Views:
    1,882
    Alexandre
    Dec 22, 2003
  2. Guest
    Replies:
    1
    Views:
    1,445
    Hans Kesting
    Apr 7, 2004
  3. Guest
    Replies:
    3
    Views:
    544
    Alexandre
    Dec 22, 2003
  4. Guest
    Replies:
    3
    Views:
    1,175
    Alexandre
    Dec 22, 2003
  5. SimonC
    Replies:
    13
    Views:
    361
    Dr John Stockton
    Jan 4, 2005
Loading...

Share This Page