Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show hours and minutes on the DateTimePicker

I'm using C# .NET and I have a Windows Form with a DateTimePicker.

My question is: how can I display the hours and the minutes (for the user to change) along with the year, month, and day?

like image 449
menachem Avatar asked Jan 11 '10 21:01

menachem


2 Answers

Check out the CustomFormat property: http://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.customformat.aspx

It allows you to set the format however you'd like. Also, to make it apply, you'll have to set the DatetimePicker.Format to Custom.

EDIT: If you provide a better idea/example of the format you want displayed, I can help with the actual format string.

like image 97
Erich Avatar answered Sep 24 '22 01:09

Erich


Set the Format property to DateTimePickerFormat.Custom and set the CustomFormat property to a format that includes the time.

like image 26
Andy West Avatar answered Sep 22 '22 01:09

Andy West