Add Months - CSharp System

CSharp examples for System:DateTime Month

Description

Add Months

Demo Code

// (c) Copyright Microsoft Corporation.
using System.Windows.Markup;
using System.Windows;
using System.Globalization;
using System.Diagnostics;
using System;//from  w w  w . j ava  2s.  co m

public class Main{
        public static DateTime? AddMonths(DateTime time, int months)
        {
            try
            {
                return cal.AddMonths(time, months);
            }
            catch (System.ArgumentException)
            {
                return null;
            }
        }
}

Related Tutorials