How to show hours and minutes on a DateTimePicker

I am using C # .NET and I have a windows form with DateTimePicker.

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

+4
source share
3 answers

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

It allows you to set the format, whatever you want. In addition to apply it, you need to set DatetimePicker.Format to Custom.

EDIT: if you provided a better idea / example of the format you want to display, I can help with the actual format string.

+7
source

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

+2
source

See all DateTimePicker properties here:

http://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker_properties.aspx

The Format property allows you to set the format string, including hours, minutes, seconds.

Edit:

Here are the predefined formats:

http://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepickerformat.aspx

As with other posters, you can set your own format in the CustomFormat property.

0
source

All Articles