View source code
Display the source code in std/datetime/systime.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Function std.datetime.systime.SysTime.add
Adds the given number of years or months to this SysTime
. A
negative number will subtract.
ref SysTime add(string units)
(
long value,
AllowDayOverflow allowOverflow = AllowDayOverflow .yes
) nothrow scope @safe
if (units == "years" || units == "months");
Note that if day overflow is allowed, and the date with the adjusted year/month overflows the number of days in the new month, then the month will be incremented by one, and the day set to the number of days overflowed. (e.g. if the day were 31 and the new month were June, then the month would be incremented to July, and the new day would be 1). If day overflow is not allowed, then the day will be set to the last valid day in the month (e.g. June 31st would become June 30th).
Parameters
Name | Description |
---|---|
units | The type of units to add ("years" or "months"). |
value | The number of months or years to add to this
SysTime . |
allowOverflow | Whether the days should be allowed to overflow, causing the month to increment. |
Authors
License
Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.