By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,560 Members | 2,989 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,560 IT Pros & Developers. It's quick & easy.

Start/End Dates for a Week

P: n/a
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

*** Sent via Developersdex http://www.developersdex.com ***
Oct 14 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 14 '05 #2

P: n/a
Bullschmidt wrote:
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

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Oct 14 '05 #3

P: n/a
<<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

*** Sent via Developersdex http://www.developersdex.com ***
Oct 14 '05 #4

P: n/a
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?

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Oct 14 '05 #5

P: n/a
Bullschmidt wrote:
<<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
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Oct 14 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.