Search code examples
c#.netvb.netwinformsdatetimepicker

Set default format of datetimepicker as dd-MM-yyyy


I have a datetimepicker which on loading of windows form shows me format in 'MM-dd-yyyy',

as follows:

enter image description here

I would like it in dd-MM-yyyy.

I tried the following:

set custom format: "dd-MM-yyyy"

But Its not changing.

What could be the problem?

Please help me.


Solution

  • Ensure that control Format property is properly set to use a custom format:

    DateTimePicker1.Format = DateTimePickerFormat.Custom
    

    Then this is how you can set your desired format:

    DateTimePicker1.CustomFormat = "dd-MM-yyyy"