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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calenderweek to date>= & date<= converter!! 1

Status
Not open for further replies.

kingz2000

Programmer
May 28, 2002
304
DE
Hi all,
Is there a way of creating a date criteria in SQL depending on calender week?
In another words, I have an SQL statement, which I would like to add a date criteria depending on the calender week entered in a textbox.. Is there anyway of converting the calender week to a 'from/until' date..??
Kingsley
 
WHERE Format([yourDateField],'ww')=yourWeekNumber

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks!! and how would I get the exact from/until dates to display on a report aswell??!! *)
 
sorry, I'll elaborate:

FRom my data it is possible that I will not get datasets for all 7 days of the calender week which is selected. However I still want to display the exact date ranges of the calender week.
I thought something like

select tour_nr,dispo_date, max(dispo_date), min(dispo_date) WHERE Format([dispo_date],'ww')=WeekNumber group by tour_nr,dispo_date

..would work, but of course I just get the ranges depending on my datasets.
How can I get the ranges of a calenderweek via SQL??

Thanks in advance.
Kingsley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top