Gambas Documentation - /lang/dateadd

/lang/dateadd

# DateAdd

Result = DateAdd ( Date as Date , Period AS Integer , Count AS Integer ) AS Date

Add a specific period to a given date.

- Date is the initial date.

- Period is the kind of period: year, month, day, week...

- Count is the number of periods to add.

The resulting date is returned.

Period can be one of the following constants:

Constant | Effect
--- | ---
`gb.Second` | Adds seconds.
`gb.Minute` | Adds minutes.
`gb.Hour` | Adds hours.
`gb.Day` | Adds days.
`gb.Week` | Adds weeks.
`gb.WeekDay` | Adds week days (ignore Saturday and Sunday).
`gb.Month` | Adds months.
`gb.Quarter` | Adds quarters.
`gb.Year` | Adds years.

### Examples

    date1 = Date(1972, 09, 06, 1, 45, 0)
    date2 = DateAdd(date1, gb.Minute, 45)
    PRINT date1, date2

    06.09.1972 01:45:00	06.09.1972 02:30:00

### See also

- Date & Time Functions