datetime.add

This function adds the specified number of years, months, and days to the specified datetime.

Syntax

datetime.add(datetime, 0, 0, 0)

Arguments

Argument

Type

Description

datetime

datetime

Specify the date and time.

years

int

Years to be added. Default is 0.

months

int

Months to be added. Default is 0.

days

int

Days to be added. Default is 0.

Returns

Type

Description

datetime

Date and time after adding the specified number of years, months, and days.

Examples

  • The function datetime.add(datetime.current(),0,0,5) returns the date and time of 5 days later.
  • The function datetime.add(datetime.current(), 1, 0, 0) returns the date and time 1 year from the current date and time such as 2023-05-11T15:38:55.34586567Z.