views:

566

answers:

3

hello,
I'm using C# .NET and I have a Windows Form with a DateTimePicker.
My question is: who can I display on the form the hours and the minuts (to choose) along with the year, mounth and day?
thanks!

+3  A: 

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.

Erich
A: 

See here for all DateTimePicker properties:

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

The Format property will let you set a format string to include hours, minutes, seconds.

Edit:

Here are predefined formats:

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

As the other poster mentioned, you can set your own format in the CustomFormat property.

FrustratedWithFormsDesigner
A: 

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

Andy West