Reputation: 4789
How can I add a masked textbox in Windows forms that accepts datetime in the following format:
01/01/1993 12:00 AM
Upvotes: 1
Views: 2796
Reputation: 11263
There is a better way to solove this using DateTimePicker
dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "MM/dd/yyyy HH:mm";
Best that can be done with MaskedTextbox is by setting following Mask
maskedTextBox1.Mask = "00/00/0000 00:00 AM"
Then again all of the validations have to be hand written by you.
Upvotes: 3
Reputation: 6347
According MS specification from here, you cannot specify such format. The most nearest meaning mask for your request would be 00\/00\/0000 90:00 \AM
Upvotes: 0