API 版本:2.0
库版本:2.83.2
由 gi-docgen 2024.1 生成的
自:2.26
GDateTime* g_date_time_add_years ( GDateTime* datetime, gint years )
创建 datetime 的副本并在此副本上添加指定的年数。添加负值来减去年数。
与 g_date_time_add_months() 类似,如果结果日期在平年的 2 月 29 日,则该日将被限制在 2 月 28 日。
自 2.26 版本开始提供
years
类型: gint
gint
年数。
类型: GDateTime
GDateTime
新创建的 GDateTime,应使用 g_date_time_unref() 释放,或 NULL。
NULL