Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Start/End Dates for a Week

Reply
Thread Tools

Start/End Dates for a Week

 
 
Bullschmidt
Guest
Posts: n/a
 
      10-14-2005
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 ***
 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      10-14-2005
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)

 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      10-14-2005
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"


 
Reply With Quote
 
Bullschmidt
Guest
Posts: n/a
 
      10-14-2005
<<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 ***
 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      10-14-2005
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)

 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      10-14-2005
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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RFC-822 dates into Ruby dates kellygreer1 Ruby 1 06-08-2008 10:59 PM
Need to use dates earlier than 1900 (Time library says out of range for dates < 1900) me@benjaminarai.com Ruby 1 07-17-2007 02:25 PM
FAQ Dates; Opera Dates. Dr J R Stockton Javascript 0 06-18-2007 03:51 PM
Dates dates dates dates... SQL and ASP.NET David Lozzi ASP .Net 1 09-30-2005 02:18 PM
Dates! Dates! Dates! PW ASP General 4 08-09-2004 04:42 PM



Advertisments