Official Content

Adds a given number of days to a given date.

Syntax

Date DateTime.AddDays(Numeric-expression)

Where:

Date DateTime
   Is a Date or DateTime expression, to which the method will add a certain number of days.

Numeric-expression
    Is a Numeric expression that indicates the number of days to be added to the Date | DateTime. 

Type Returned:
Date | DateTime

Scope

Data Types: Date DateTime

Description

Returns a value that results from adding a number of days to a given date or date with time.

The result data type will be the same as the given original value (Date or DateTime).

If the numeric expression is negative, the days are subtracted from the given date.


Notes:

  • GeneXus verifies the resulting date in order to obtain a valid one.
  • In Microsoft SQL Server, this function takes part of the SQL sentence send to the database manager.

Samples

&Date1 = &Date1.AddDays(7) // Adds one week to Date1 variable

You can also add days to a given date just by using the '+' operator:

&Date1 = &Date1 + 7 // Adds one week to Date1 variable

Availability 

This method is available since GeneXus X Evolution 2.

See Also

AddYr function
AddHours method
AddMinutes method







Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant