C#DateTimeAddMonths
AddYears

AddMonthsDateTime

AddDays

Returns a new DateTime with the specified number of months added.

Syntax

dt.AddMonths(months)

Example

Enter values below to update the example in real time.

dt
new
AddMonths
Console
WriteLine
ToString
DateTime dt = new DateTime(2024, 11, 30);
DateTime next = dt.AddMonths(2);
Console.WriteLine(next.ToString("yyyy-MM-dd"));   // "2025-01-30"