Date Calculation

Satyapriyanayak
Posted by Satyapriyanayak under C# category on | Points: 40 | Views : 913
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication5
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
DateTime dt1 = DateTime.Parse(Convert.ToDateTime(textBox1.Text).ToShortDateString());//input as 2013,3,26(yyyy,mm,dd)
int noofYear = Convert.ToInt32(textBox2.Text);
textBox3.Text = dt1.AddYears(noofYear).ToString("dd/MM/yyyy");
}
}
}

Comments or Responses

Login to post response