Equinox Online Help - Language Reference - A to Z

Home

Dmyadd

Applies to
SyntaxDmyadd(DateExpression [, DaysExpression, MonthsExpression, YearsExpression])
Action[Function] Returns a date constant calculated by adding offsets to a starting date.
ScopeUsable anywhere.
Notes

This function returns a date value, calculated by adding DaysExpression, MonthsExpression and YearsExpression to DateExpression. The day, month and year expressions are optional and you may include one, two, or all of them. If you omit any of these values, they default to 0. Note that you can use negative arguments, to calculate an earlier date.

The function operates slightly differently, depending on whether or not DaysExpression is omitted. If it is omitted, then the calculation is performed in months and years. If the resulting date is invalid (eg '31-2-94') then the closest valid day is returned instead (eg '28-2-94'). If DaysExpression is included then the calculation is performed in days and the resulting number of days is converted to a date.

CategoryDate handling
See Also Years, Year, Day, Dayname, Dayofweek, Dayofyear, Leapyear, Month, MonthName, Months, ServerDateTime, Today, Week, WeekOfYear, WeekStart
Example

The first example subtracts one year from LastDate.

LastDate = Dmyadd(lastdate, , , -1)

The next example calculates DueDate as thirty days from today.

DueDate = Dmyadd(Today, 30)

Note that the above example could also be achieved as follows.

DueDate = Today + 30

This example prints the 3rd of March, 1994.

Print Dmyadd('31-1-94', 0, 1)

However, this example prints the 28th of February, 1994.

Print Dmyadd('31-1-94', , 1)

The next example adds eighteen months to calculate the overdue date.

OverdueDate = Dmyadd(Today, , 18)

The last example calculates NextDate by adding 1 Year 3 months and 15 days to LastDate.

NextDate = Dmyadd(LastDate, 15, 3, 1)