Contents

Roo

DateTime.sub_years()

Creates and returns a new DateTime object by subtracting the specified number of years from this DateTime object. This DateTime object is unaltered by the operation.

datetime.sub_years(years As Number) as DateTime

Parameters

  • years. Number. The number of years to subtract from this DateTime object

Returns

  • A new DateTime object

Example

var xmas = DateTime(2017, 12, 25, 9, 30, 15) # Dec 25th 2017 9:30:15 AM.
var d = xmas.sub_years(17)
print(d) # Dec 25th 2000 9:30:15 AM.