Hi
check this out
------------------------
The information in the article refers to:
Seagate Crystal Reports 8
Applies to:
All versions
Adding days, months years and so on to a date field
formulas
Crystal Reports version 6 and 7
Synopsis
How do you add or subtract a specified date interval, for example days, months, years and so on, from a date field?
Solution
To add or subtract days, months, or years from a date field use the DateAdd function. This function is installed automatically in Crystal Reports version 8 and higher, for both Crystal and Basic syntax.
Note:=======
If you have version 6 or 7 of Crystal Reports, to obtain the DateAdd function go to
Click 'Files/Updates', then click 'Find a file'.
Search for UFLDateAdd.exe.
Download and run this file, then follow the installation instructions in readme.txt
============
The following information applies to using Crystal Syntax or Basic Syntax in the Formula editor.
DateAdd (intervalType, nIntervals, startDateTime)
The DateAdd function takes three parameters:
- intervalType is a String expression specifying the interval of time to be added or subtracted.
Note:========
For a complete list of the interval types, for example days, weeks, and so on, refer to DateAdd in the Crystal Reports online help.
============
- nIntervals is a Number or numeric expression specifying the number of intervals to be added. It can be positive (to get date-times in the future) or negative (to get date-times in the past).
- startDateTime is the DateTime value to which the intervals are to be added or subtracted.
Examples:
//Adds one day to the Order Date field of the Orders table.
DateAdd("D",1, {Orders.OrderDate})
//Subtracts one day from the Order Date field of the Orders table.
DateAdd("D",-1, {Orders.OrderDate})
//Adds one month to the Order Date field of the Orders table.
DateAdd("M",1, {Orders.OrderDate})
//Subtracts one month from the Order Date field of the Orders table.
DateAdd("M",-1, {Orders.OrderDate})
//Adds one year to the Order Date field of the Orders table.
DateAdd("YYYY",1, {Orders.OrderDate})
//Subtracts one year from the Order Date field of the Orders table.
DateAdd("YYYY",-1, {Orders.OrderDate})
------------------------------------------------------------
cheers
pgtek