Datetime.sub
This function subtracts the given number of years, months, or days from the datetime.
Syntax
datetime.sub(datetime, 0, 0, 0)
Arguments
Argument |
Type |
Description |
---|---|---|
datetime |
datetime |
Specify date and time. |
years |
int |
Years to be subtracted. The default is 0. |
months |
int |
Months to be subtracted. The default is 0. |
days |
int |
Days to be subtracted. The default is 0. |
Returns
Type |
Description |
---|---|
datetime |
Date and time after subtracting the specified years, months, and days. |
Examples
The function datetime.sub(datetime.current(), 1,1,1)
returns the date and time of 1 year, 1 month, and 1 day ago.