Dates, weeks and days 
Author Message
 Dates, weeks and days

Greeintgs,

I need people to select a week from the form, once they select let's say
week 46  from the Week of year function it should show them all the dates
for this week and this week only, considering that the week begins on Monday
and ends on sunday.

Any solutions?

thank you,
Roger



Sun, 11 May 2003 03:00:00 GMT  
 Dates, weeks and days
Uh, Roger, as the lawyers would say: Asked and answered. Here's yesterday's
answer to your question then, and it hasn't changed much.

...check out the date and time
functions in the VBScript doc online at:
http://msdn.microsoft.com/scripting/ and click on the VBScript link on the
right, then the documentation link, then the Language reference; all of the
functions you want are in there. Of probable interest are DateAdd and
DatePart.

So, if your interval startdate was today, the logic would be something like:

dtStart = Date  'or whatever date starts your series
intWeek = Request.Form("inputWeek")              'See Note #1
dtShowDate = DateAdd("ww", intWeek, dtStart)
for i = 0 to 6
    Response.Write DateAdd("d", i, dtShowDate)   'See Note #2
next

Note #1: Or whatever you do to provide the input week (the week 46
selection) to the script
Note #2: Or whatever you need to do to display the dates involved

The only wrinkle to add at this point is that based on your needing the week
to begin on Monday is to say that your dtStart above should also be a
Monday, too, and that simplifies life a bit. This is one of about a dozen
variations, but something like it should work.

Quote:

> Greeintgs,

> I need people to select a week from the form, once they select let's say
> week 46  from the Week of year function it should show them all the dates
> for this week and this week only, considering that the week begins on
Monday
> and ends on sunday.

> Any solutions?

> thank you,
> Roger



Sun, 11 May 2003 03:00:00 GMT  
 Dates, weeks and days
hehe well Thanks for a second answer to, it works great.


Quote:
> Uh, Roger, as the lawyers would say: Asked and answered. Here's
yesterday's
> answer to your question then, and it hasn't changed much.

> ...check out the date and time
> functions in the VBScript doc online at:
> http://msdn.microsoft.com/scripting/ and click on the VBScript link on the
> right, then the documentation link, then the Language reference; all of
the
> functions you want are in there. Of probable interest are DateAdd and
> DatePart.

> So, if your interval startdate was today, the logic would be something
like:

> dtStart = Date  'or whatever date starts your series
> intWeek = Request.Form("inputWeek")              'See Note #1
> dtShowDate = DateAdd("ww", intWeek, dtStart)
> for i = 0 to 6
>     Response.Write DateAdd("d", i, dtShowDate)   'See Note #2
> next

> Note #1: Or whatever you do to provide the input week (the week 46
> selection) to the script
> Note #2: Or whatever you need to do to display the dates involved

> The only wrinkle to add at this point is that based on your needing the
week
> to begin on Monday is to say that your dtStart above should also be a
> Monday, too, and that simplifies life a bit. This is one of about a dozen
> variations, but something like it should work.




- Show quoted text -

Quote:
> > Greeintgs,

> > I need people to select a week from the form, once they select let's say
> > week 46  from the Week of year function it should show them all the
dates
> > for this week and this week only, considering that the week begins on
> Monday
> > and ends on sunday.

> > Any solutions?

> > thank you,
> > Roger



Sun, 11 May 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Date / Same date or first day of week

2. Date of the first day of the Week

3. date validation week days

4. Creating instances of dates based on days of the week

5. Date of first day of week?

6. A five day week for date calculation

7. Find first day of week for date entered

8. Get the day of the week from a date in the text

9. Get the day of the week from a date in the text

10. Extracting a date from year,week,day

11. Help with extracting the day of the week out of the date

12. rookie question re: Date/Day of week

 

 
Powered by phpBB® Forum Software