We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Using MaskEdit for DateTime shows Time in 12-Hour Format

I am using MaskEdit in a DataBound Grid and am experiencing a problem with getting the time formatted as 24-hour time. I would like a DateTime value such as 1/1/2011 10:15:34 PM to show in the grid as 1/1/2011 22:15. I have the Style.Format set to the .Net DateTime Format that I want: "MM/dd/yyyy HH:mm" but the MaskEdit apparently does not use this. I also tried altering the formats in the MaskEdit.DateTimeFormatInfoObject and that did not work.

Any help with getting the Time portion of a DateTime value in a MaskEdit control to show in 24-hour format would be greatly appreciated.

Thanks,
Scott Numbers


1 Reply

VR Varalakshmi R.S Syncfusion Team December 20, 2010 06:26 AM UTC

Hi Scott,

Thank you for your interest in Syncfusion products.

The mask format “Mask="##/##/#### ##:##” in the MaskedEditControl just displays the given input value in DateTime format. So, we suggest you to use DateTimeTextBox for assigning 24 hour time format.

This can be set by using the following code,
[C#]

DateTimeTextBox1.Format = DateTimeFormatType.CustomString;
DateTimeTextBox1.CustomFormat = "MM/dd/yyyy HH:mm:ss:ff tt"; //HH:mm:ss:ff tt denotes the 24 hour time format

Kindly refer the following link to know more information on TimeFormat in DateTimeTextBox.
http://help.syncfusion.com/ug_84/User%20Interface/ASP.NET/Tools/Documents/dateandtimeformat.htm

Please let me know if this helps,

Regards,
Varalakshmi.R.S



Loader.
Live Chat Icon For mobile
Up arrow icon