Start/End Dates for a Week

B

Bullschmidt

If I know the week number and the year, how can I calc the beginning and
ending dates of the week?

For background I'm going to do some grouping by week but don't just want
to call the weeks Week 25, Week 26, Week 27, etc.

Thanks in advance,
J. Paul Schmidt, Freelance Web and Database Developer
http://www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
 
E

Evertjan.

Bullschmidt wrote on 14 okt 2005 in
microsoft.public.inetserver.asp.general:
If I know the week number and the year, how can I calc the beginning and
ending dates of the week?

For background I'm going to do some grouping by week but don't just want
to call the weeks Week 25, Week 26, Week 27, etc.


Dr John Stockton on Feb 16 2004, 8:32 pm wrote here:
<http://groups.google.com/group/alt.comp.lang.borland-
delphi/msg/c510a6cb062cbc4c>
Be very careful about advice from America; AIUI, over there they have
more different week number standards than is really desirable. Be
careful to test any function you choose rather exhaustively, covering
all 14 combinations of leapness and day-of-week of Jan 1st and checking
both ends of the year.

Probably you want the ISO-8601 standard week number, for which see
<URL:http://www.merlyn.demon.co.uk/weekinfo.htm>,
<URL:http://www.merlyn.demon.co.uk/wknotest.txt>, and
<URL:http://www.merlyn.demon.co.uk/programs/dateprox.pas>.

These are a good start, methinks, Paul.
 
B

Bob Barrows [MVP]

Bullschmidt said:
If I know the week number and the year, how can I calc the beginning
and ending dates of the week?

For background I'm going to do some grouping by week but don't just
want to call the weeks Week 25, Week 26, Week 27, etc.

First of all, define "week". The definition can depend on locale.

My recommendation is to use a calendar table in a database, especially if
your weeks are non-standard (e.g., fiscal weeks). Even if the weeks are
"standard", you can get many benefits besides week start/end dates from a
calendar table.
http://www.aspfaq.com/show.asp?id=2519
 
B

Bullschmidt

<<First of all, define "week". The definition can depend on locale.>>

DatePart("WW", [MyDateField])


Best regards,
J. Paul Schmidt, Freelance Web and Database Developer
http://www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
 
E

Evertjan.

Bullschmidt wrote on 14 okt 2005 in
microsoft.public.inetserver.asp.general:
<<First of all, define "week". The definition can depend on locale.>>

DatePart("WW", [MyDateField])

From the specs:

firstdayof week
Optional. Constant that specifies the day of the week. If not specified,
Sunday is assumed. See Settings section for values.

firstweekofyear
Optional. Constant that specifies the first week of the year. If not
specified, the first week is assumed to be the week in which January 1
occurs. See Settings section for values.

That your definitions?
 
B

Bob Barrows [MVP]

Bullschmidt said:
<<First of all, define "week". The definition can depend on locale.>>

DatePart("WW", [MyDateField])
That's not what I meant:

Does the week start on Sunday or Monday in your locale?
Does the designation of 1 to a week depend on which day of the week 1-Jan
falls?

Using a calendar table makes these questions irrelevant, since you (or the
person entering the data into the calendar table) will have absolute control
over the week numbers used for each date.

Bob Barrows
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top