Friday, February 24, 2012

How to add 12 months to the CurrentDate

Ciao, i'm using Crystal Report 6 and I have a formula field which must show the currentdate + 12 months, i.e.: today is 16/11/2004, i need 16/10/2004.
Could you help me?
I'm trying the data functions but i'm not able to solve my problem :-\Solution:
CurrentDate + 365

Ops... :-p
Ciao :-)|||above solution works except for Leap years.....
alternative is :
formula = dateAdd("m", 12, CurrentDate)

you can do add and subtract arithmetic on dates using DateAdd.
1st paremeter = either "d", "m", or "y",
2nd parameter is amount you want to inbcrement or decrement by,
last parameter is date you want to use as basis of calculations

Dave

No comments:

Post a Comment