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

How do I find the 10th of the month after the purchase date

Status
Not open for further replies.

KayKay

MIS
Jan 11, 2001
15
US
sql2k
cr9

I need to be able to find the 10th of the month following the purchase date (supplied from table).

Is there a simple formula for this?

Please help

KayKay
 
The following will give you the 10th of the month for the month following the purchase date.

dateadd("m",1,{table.purchdate}-day({table.purchdate})+10)

Or did you want the NEXT 10th of the month, even if it is in the same month?

-LB

 
I think that this will work just fine.

If I do want the next month would I need to check the purchase and do something like this?

if day({table.purchdate})<=10 then
dateadd("m",2,{table.purchdate}-day({table.purchdate})+10)

KayKay




 
I just read what I wrote and realize that it makes no sense, sorry. What I meant to ask is:

If {table.purchdate} <=10 (ex.01/02/05)
how do I get the due date to be 01/10/05?

Thanks again
 
try this:

if day({Table.purchdate})<=10 then date(year({Table.purchdate}),Month({Table.purchdate}),10) else
dateadd("m",1,{table.purchdate}-day({table.purchdate})+10)



Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
You could use:

if day({table.purchdate}) <= 10 then
{table.purchdate}-day({table.purchdate}) + 10 else
dateadd("m",1,{table.purchdate}-day({table.purchdate})+10)

-LB
 
Thank you both, dgillz and lbass so much. This is exactly what I needed!

KayKay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top