List of Exercises

Custom Format in DateTimePicker in WinForms c#

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

namespace Datetimepicker_Control
{
  public partial class Form1 : Form
  {
    DateTime datetime;
    public Form1()
    {
      InitializeComponent();
     
      dateTimePicker1.Value = new DateTime(2000, 1, 1, 12, 3, 00);
      dateTimePicker1.MinDate = new DateTime(1990, 1, 1, 0, 0, 0);
      dateTimePicker1.Format = DateTimePickerFormat.Custom;
      dateTimePicker1.CustomFormat = "yyyy MMMM dddd hh:mm:ss";
      dateTimePicker1.ShowUpDown = false;
      dateTimePicker1.ShowCheckBox = true;
      
    }

    private void button1_Click(object sender, EventArgs e)
    {
      var dt = dateTimePicker1.Value;
    }

    private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
    {
      datetime = dateTimePicker1.Value;
    }
  }
}
		
	 


Download the project of Visual Studio 2013 in DropBox Download


Setting the Custom Format for the DateTimePicker in WinForms C#


Video Thumbnail