DateTime.addYears

glib.date_time.DateTime addYears(int years)

Creates a copy of datetime and adds the specified number of years to the copy. Add negative values to subtract years.

As with [glib.date_time.DateTime.addMonths], if the resulting date would be 29th February on a non-leap year, the day will be clamped to 28th February.

Parameters

yearsthe number of years

Returns

the newly created #GDateTime which

should be freed with [glib.date_time.DateTime.unref], or null