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 CodeProjectAnswer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
DateTime d = DateTime.Now;
string date = DateTime.Now.ToString("ddMMyy");
txtDate.Text = date.ToString();
}
private void button1_Click(object sender, EventArgs e)
{
string DayMonthYear="";
string cdate = txtDate.Text.ToString();
if (cdate.Length > 0)
{
string day=cdate.Substring(0, 2);
string month = cdate.Substring(2, 2);
string year = cdate.Substring(4, 2);
if (DateTime.Now.ToString("yy") == year)
{
DayMonthYear = DateTime.Now.ToString("yyyy");
if (DateTime.Now.ToString("MM") == month)
{
DayMonthYear += DateTime.Now.ToString("MM");
if (DateTime.Now.ToString("dd") == day)
{
DayMonthYear += DateTime.Now.ToString("dd");
txtConvertDate.Text = DayMonthYear.ToString();
}
}
}
}
}
}
}