Since Sunday...

1. Senior Member
Join Date
Dec 1969
Posts
604

## Since Sunday...

How do you return data entered since, say, Sunday of the current week in an SQL statement...?<BR><BR>

2. Senior Member
Join Date
Dec 1969
Posts
259

## RE: Function to find sunday...

function WeekStart()<BR> WeekStart = Date() - (weekday(date)-1)<BR>end function<BR><BR>Response.Write weekstart

3. Senior Member
Join Date
Dec 1969
Posts
604

## Brilliant! Thanks

.

4. Senior Member
Join Date
Dec 1969
Posts
11,247

## Needs to be expanded slightly

function WeekStart()<BR> if WeekDay(date() = 1 Then<BR> WeekStart = Date()<BR> else<BR> WeekStart = Date() - (weekday(date)-1)<BR> end if<BR>end function<BR>

5. Senior Member
Join Date
Dec 1969
Posts
259

## RE: Oops, Thanks! <eom>

.

6. Senior Member
Join Date
Dec 1969
Posts
96,118

## WHAT??? WHY????

Look at his original code:<BR><BR>function WeekStart()<BR> WeekStart = Date() - (weekday(date)-1)<BR>end function<BR><BR>Okay, say that today *is* Sunday.<BR><BR>So then <BR> weekday(date) will be 1, right?<BR>and then<BR> weekday(date) - 1 will be zero, right?<BR>and then <BR> Date() - ( weekday(date) - 1 )<BR>will be the same as<BR> Date() - 0<BR>which will be...what else...the same as <BR> Date()<BR><BR>Now, please explain to me how that answer is any different than what you get with your more complex code?<BR><BR>

7. Senior Member
Join Date
Dec 1969
Posts
96,118

## Don't give in so easy...you were right!

8. Senior Member
Join Date
Dec 1969
Posts
11,247

## Teach me to

drink coffee and read posts over the rim of my cup...<BR><BR>of course you are right

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•