Set default format of datetimepicker as dd-MM-yyyy

C Sharper picture C Sharper · Oct 19, 2013 · Viewed 177.7k times · Source

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.

Answer

ElektroStudios picture ElektroStudios · Oct 19, 2013

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"