Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WeekVal???

Status
Not open for further replies.

Brambojr

Technical User
Oct 26, 2000
73
US
I am working on a very simple database, but have hit a wall. What I need is a way to "lump" order entries into weeks. By that I mean if something is added on Monday And Tuesday they are on the same order. Then next week would be seperate. I want this to be invisble and thoughtless for the enduser. Can you help?? Brambojr
 
One possible solution is to create a database that has the year(s) broken into the 52 possible starting points. Provided you span the end of year.

ie.
01/01/2001 - 1
01/08/2001 - 2
01/15/2001 - 3

While this is one approach, I'm sure there are others that provide a more robust code oriented solution. Steve
Steve Medvid
Atlas Commerce ("ebusiness evolved")
 
The DATEPART function can tell you the relative week number of the year for any given date.

DatePart("ww",[yourdate])

Dave
 
The question is somewaht ambigious. The datepart answere the more-or-less direct question. For most real situations, the week alone won't really be sufficient. You probably want to include some part of the year - or include a where Year = [expr] or date between [strtdt] and [enddt] expression as criteria.

Obviously, the question needs to be set into a broader context to give a complete answer.

To further cloud the issue, datepart depends on the system settings for the startoftheweek and firstweekoftheyear to determine the actual value returned, so you also need to review these to be sure you are getting the value you are asking for.


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top