Hi,
How to get Just a time format with DateTimeEditor?
I've tried to put FormatString in "t" but i get 01/01/2008 00:00:00I've tried to put MaskInpu to {time} i get the same result...
Please help.
Thanks
As you mentioned setting the MaskInput to {time} should get the behavior you are looking for. If you only set the FormatString property, the the time will display only when the control is in edit mode (when the cursor is in the control). I tested with Visual Studio 2005 and NetAdvantage 2007 Volume 3, 7.3.20073.38, and did not have any issues. Are you possibly using Visual Studio 2008 with a version prior to NA 2008 Volume 1?
I would not use the DateTimeEditor if all you are interested in is time. It is more of a date chooser then a time picker.
Instead, use a UltraMaskEdit control. Set the EditAs property to DateTime and InputMask to {time}.
If I use the UltraMaskEditor, set the EditAs to DateTime and the InputMask is set to to {time} can I save to my DB just the time? Right now if I set to what you mention what is written tot he DB is the full DATE/TIME. I would just like the time (HH:MM AM).
Hello,
You could retrieve the needed information by using the following code:
((DateTime)ultraMaskedEdit1.Value).ToShortTimeString();
Please feel free to let me know if I misunderstood you or if you have any other questions.
This control is bound to a datasource so I want the value to be written to the DB with just the time. Would I need to use a datafilter to do this?
Hi Roger,
You could try a DataFilter, but I'm not sure if that will work.
You would probably be better off using the Parse and Format methods of the Binding - assuming that you don't need the Date portion in your code.
Okay, thanks.