CSharp examples for System:DateTime Calculate
dt1 subtract dt2 to get the month count between them
// Copyright (C) Microsoft Corporation. All rights reserved. using System;/* w ww. ja v a 2 s . c o m*/ public class Main{ /// <summary> /// dt1 subtract dt2 to get the month count between them /// </summary> /// <returns>the months between dt1 and dt2</returns> internal static int SubtractByMonth(DateTime dt1, DateTime dt2) { return (dt1.Year - dt2.Year) * 12 + (dt1.Month - dt2.Month); } }