I have a question people..plz help me...here are the code lines.....
public partial class Form1 : Form
{
public DateTime today = System.DateTime.Today;
public DateTime FinalDayOfPayment= Convert.ToDateTime("1/12/2011");
public TimeSpan noOfDays;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
label1.Text = today.ToString();
label2.Text = FinalDayOfPayment.ToString();
noOfDays = today - FinalDayOfPayment;
label3.Text = noOfDays.ToString();
}
}
This gives me the no of days...but a want to get the no of months..
Is there any other way to get it..???
Loading

Raja KrishnamurthyRank #3,615 · 403 reputationPosted Apr 14, 2011, 4:21 AM EDT
int differenceInMonths = Math.Abs(12 * (FinalDayOfPayment.Year - today.Year) + FinalDayOfPayment.Month - Today.Month) //will work if the Final Date is lesser than today too and any year
HTH
VulpesRank #55 · 29.2K reputationPosted Apr 14, 2011, 4:51 AM EDT
Suthish NairRank #92 · 22.8K reputationPosted Apr 14, 2011, 6:23 AM EDT
DateTime today = System.DateTime.Today;