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

Day Selection

Status
Not open for further replies.

JTinVA

Programmer
Aug 5, 2002
22
US
I'm trying to run a report that select all records from two Sundays ago (regardless of what day today is). I can't seem to figure this one out. I'd appreciate any help anyone has!

Thanks.
 
The following formula will show two Sundays back. For today's date it will show January 12. If the date is a Sunday, it will show the previous Sunday. Jan 19 gives Jan 12.

Create this formula:

datevar d:={date.field};
datevar sunday;
datevar twosunprev;

sunday:=d-dayofweek(d)+1;
twosunprev:=date(dateadd("ww",-1,sunday))


then use the formdatevar d:={date.field};
datevar sunday;
datevar twosunprev;
sunday:=d-dayofweek(d)+1;
twosunprev:=date(dateadd("ww",-1,sunday))

Mike
If you're not part of the solution, you're part of the precipitate.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top