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

Precise 2 month daterange

Status
Not open for further replies.

Steve95

MIS
Nov 3, 2004
265
US
Hi All

I need to know of how to put together a formula which brings me back data ranging only for a 2 month period or less.

I compiled a formula:
datediff ("m", {?Start Date},{?End Date}) <= 2

and find this brings back dataset of over 2 months ie.
06/01/2006 - 09/03/2006

Many Thanks in advance

 
Assuming that you're using parameters, try:

{table.datefield} >= {?Start Date}
and
{table.datefield} <= {?Start Date}

If you need 2 months from todays date, or some passed date, use:

{table.datefield} >= dateserial (year(currentdate),month(currentdate)-2,day(currentdate)
and
{table.datefield} <= currentdate

-k
 
You might try an if/then
if datediff ("m", {?Start Date},{?End Date}) <= 2
then datediff("m", {?Start Date},{?End Date})

depending on what you what to happen with the ones over 2 you can put that in the else.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top