How do I set Custom Date Format in DateTimePicker (WinForms)?

Posted by Rojasamala under VB.NET on 8/1/2013 | Points: 10 | Views : 12344 | Status : [Member] | Replies : 3
How do I set Custom Date Format in DateTimePicker (WinForms)?

Thanks
S Roja
http://aspdotnet-roja.blogspot.com



Responses

Posted by: Bandi on: 8/1/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
You need to set the Format of the DateTimePicker to Custom and then assign the CustomFormat.

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

DateTimePicker1.Format = DateTimePickerFormat.Custom
DateTimePicker1.CustomFormat = "dd/MM/yyyy" Here you can set the custom date format
End Sub


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Rojasamala, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: aswinialuri-19361 on: 8/1/2013 [Member] Starter | Points: 25

Up
0
Down
hi ,
Use this code -

this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dateTimePicker1.CustomFormat = "dd/MM/yyyy";
this.dateTimePicker1.ShowUpDown = false;


refer this link

http://social.msdn.microsoft.com/Forums/windows/en-US/45d8ad4b-cb47-4d35-a68e-568502f84677/custom-date-format-in-datetimepickerwinforms

Mark as Answer if it helps you
Thanks&Regards
Aswini Aluri

Rojasamala, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kundan64 on: 8/1/2013 [Member] Starter | Points: 25

Up
0
Down
You can set the Format and FormatType as told above in runtime or you can do it in Design time also in Properties window of DateTimePicker control.
Same properties are available in Design Time.


Rojasamala, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response