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

How to add 6 Months to Print Date 1

Status
Not open for further replies.

byrne1

Programmer
Aug 7, 2001
415
US
I need a field that will show a date on the report that is 6 months from the date the report is printed (ie, an expiration date).

My version of CR (7.0.1) does not have the DateAdd function. Is there another way to do this?
 
Yes I could, I guess, but I would like it to be an automatic calculation without the user having to key in the date.
 
Is dateserial() available? Try:

dateserial(year(Currentdate),month(currentdate)+6, day(currentdate))

-LB
 
No DateSerial is not an available function, nor is DateAdd.
 
Try something like:

if day(currentdate) <= 28 then
(
if month(currentdate) <= 6 then
date(year(currentdate),month(currentdate)+6, day(currentdate)) else
if month(currentdate) > 6 then
date(year(currentdate)+1, month(currentdate)-6, day(currentdate))
) else
if day(currentdate) >= 29 then
(
if month(currentdate) <= 6 then
date(year(currentdate),month(currentdate)+7, 01)-1 else
if month(currentdate) > 6 then
date(year(currentdate)+1, month(currentdate)-5, 01) -1
)

This would default to the last day of the month if the day of the month was >= 29. Not perfect, but maybe close enough?
There might be another way I haven't thought of.

-LB
 
try this in a formula field

currentdate + 180

this will always give you six months from today.... well approximately

Mo
 
That took care of it. As you said, it's not exact, but it accomplished what I needed. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top