DateTimePicker: pick both date and time
Set the Format to Custom and then specify the format:
dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "MM/dd/yyyy hh:mm:ss";
or however you want to lay it out. You could then type in directly the date/time. If you use MMM, you'll need to use the numeric value for the month for entry, unless you write some code yourself for that (e.g., 5 results in May)
Don't know about the picker for date and time together. Sounds like a custom control to me.
DateTime Picker In WinForm How To Pick Time?
You can use the built in DateTime picker by adding a custom format string as follows:
DateTimePicker.ShowUpDown = true;
DateTimePicker.CustomFormat = "hh:mm";
DateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
Enjoy!
How to Select time in Date Time picker
You can set the CustomFormat
for your DateTimePicker
:
dateTimePicker1.CustomFormat = "MM/dd/yyyy hh:mm:ss tt";
dateTimePicker1.Format = DateTimePickerFormat.Custom;
NOTE: the code above will allow user to modify all the elements: dates and time. I think that's what you want. If you want to show the Clock
, it's a lot to do more. There are some simple Clock
control already built for you.
You can search for more with the keyword Clock control
, especially in codeproject.com
(there are tons of controls), here is just 1:
http://www.codeproject.com/Articles/10627/Yet-Another-Analog-Clock
Make DateTimePicker work as TimePicker only in WinForms
A snippet out of the MSDN:
'The following code sample shows how
to create a DateTimePicker that
enables users to choose a time only.'
timePicker = new DateTimePicker();
timePicker.Format = DateTimePickerFormat.Time;
timePicker.ShowUpDown = true;
And for anyone who wants to know what it looks like:
Related Topics
Datetimepicker: Pick Both Date and Time
Test If Object Implements Interface
Http Post Returns Error: 417 "Expectation Failed."
Automatically Update Version Number
Better Way to Cast Object to Int
Finding All Combinations of Well-Formed Brackets
Entity Framework - Add Navigation Property Manually
Why Are Const Parameters Not Allowed in C#
How to Create Roles in ASP.NET Core and Assign Them to Users
Using a 32Bit or 64Bit Dll in C# Dllimport
How to Download a Nuget Package Without Nuget.Exe or Visual Studio Extension
The Remote Certificate Is Invalid According to the Validation Procedure