Display a Date in a Custom Format with the Windows Forms DateTimePicker Control

dateTimePicker1.Format = DateTimePickerFormat.Custom;
// Display the date as "Mon 27 Feb 2012".
dateTimePicker1.CustomFormat = "ddd dd MMM yyyy";
// Display the date as "27 Feb 2012".
dateTimePicker1.CustomFormat = "dd MMM yyyy"; 
// Display the date as "27 Feb 2012". 
dateTimePicker1.CustomFormat = "dd MM yyyy";
// Display the date as "27 Feb 2012". 
dateTimePicker1.CustomFormat = "dd/MM/yyyy"; 

use form load or any other event;
suggest form load is mutch better than the set the property of Date Time Picker.  

Comments

  1. Check "dd" -> "DD" and "MM" -> "mm"
    They are case sensitive!!!!

    ReplyDelete

Post a Comment

Popular posts from this blog

Brother printer password reset using telnet

How to adjust the brightness in Samsung 19" SyncMaster SA100 LED monitor?

Samsung SA100 Monitor Brightness Adjustment Tool