473,385 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Start/End Dates for a Week

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
5 3282
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
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
<<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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Peter Pfeiffer | last post by:
I've written several scripts that have "while" blocks which increment a date by one day if the date does not match one of a group of dates. However, sometimes it apparently steps out out the while...
2
by: Simon Pleasants | last post by:
I recently built a database to help keep track of shipments we are bringing into the country. Included in the database are a number of fields with dates for shipment, ETA etc. Each one of these...
4
by: Alicia | last post by:
I am having a problem grouping by week. I am looking for the simpliest way of doing it in Microsoft Access. I have tried to use a pre-loaded calender, access did not like it at all. If there is...
1
by: Alicia | last post by:
I basically wanted something that would do a count of the dates, then group them by their week name.. BEFORE: Resource Date Total number of times that date Appeared (Count) 4/3/03 ...
2
by: Marcus | last post by:
I know how to fromat dates by weeks, as in Format(,"ww"). However, this displays the week as a number, such as 1, 2, 3, 4, to represent 1st week, 2nd week etc of the year. I am wondering if...
6
by: Bill R via AccessMonster.com | last post by:
I have a query: SELECT tblCalendar.CalendarDay AS LastSunday FROM tblCalendar WHERE (((tblCalendar.CalendarDay)>=(Now()-7) And (tblCalendar.CalendarDay)...
3
by: | last post by:
Hello, I am hoping someone else has thought about a date time calculation i need to perform. I would like to be able to calculate the number of "working minutes" between 2 dates, given my...
3
by: Tim Chase | last post by:
I've been trying to come up with a good algorithm for determining the starting and ending dates given the week number (as defined by the strftime("%W") function). My preference would be for a...
5
by: Elainie | last post by:
I need to get the dates between now and next week but using Now and Next week not any specific dates... Please help, going mad... Elaine
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.