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.
Unfortunately, activation email could not send to your email. Please try again.

Using MaskEdit for DateTime shows Time in 12-Hour Format

Thread ID:

Created:

Updated:

Platform:

Replies:

97622 Dec 17,2010 09:52 AM Dec 20,2010 01:26 AM ASP.NET Web Forms (Classic) 1
loading
Tags: Tools
Scott Numbers
Asked On December 17, 2010 09:52 AM

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


Varalakshmi R.S [Syncfusion]
Replied On December 20, 2010 01:26 AM

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



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;