using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication5
{
    public partial class frmdate : Form
    {
        DateTime dt;
        StringBuilder st;
        int year, month, day;
        public frmdate()
        {
            InitializeComponent();
        }

        private void frmdate_Load(object sender, EventArgs e)
        {
            st = new StringBuilder();
            System.Globalization.PersianCalendar pe = new System.Globalization.PersianCalendar();

            txby.Text = pe.GetYear(DateTime.Now).ToString();
            st.Append(txby.Text);
            txbmo.Text = pe.GetMonth(DateTime.Now).ToString();
            st.Append(txbmo.Text);
            txbd.Text = pe.GetDayOfMonth(DateTime.Now).ToString();
            st.Append(txbd.Text);
            txbh.Text = pe.GetHour(DateTime.Now).ToString();
            st.Append(txbh.Text);
            txbmi.Text = pe.GetMinute(DateTime.Now).ToString();
            st.Append(txbmi.Text);
        }

        private void btncb_Click(object sender, EventArgs e)
        {

            Clipboard.SetText(dt.ToString());
        }

        private void txby_TextChanged(object sender, EventArgs e)
        {

        }

        private void btncb1_Click(object sender, EventArgs e)
        {


            year = Convert.ToInt32(txby.Text);
            month = Convert.ToInt32(txbmo.Text);
            day = Convert.ToInt32(txbd.Text);

      dt=  new DateTime(year,month,day, new System.Globalization.PersianCalendar());
   
      
      txby1.Text = dt.Year.ToString();
     
      txbmo1.Text = dt.Month.ToString();
   
      txbd1.Text = dt.Day.ToString();

      txbh1.Text = DateTime.Now.Hour.ToString();

      txbmi1.Text = DateTime.Now.Minute.ToString();
    
        }
    }
}
