New to Telerik UI for WinFormsStart a free 30-day trial

Date and Time Masks

Updated over 6 months ago

The tables below describe the mask characters that can be used when the MaskType is DateTime. Note that the format characters are case sensitive.

Standard Date Format codes

Full list of the supported masks can be found in the following MSDN article: Standard DateTime masks

Format CharacterDescription
dShort date pattern
DLong date pattern
fFull date and time (long date and short time)
FFull date time pattern (long date and long time)
gGeneral (short date and short time)
GGeneral (short date and long time)
m, MMonth day pattern
r, RRFC1123 pattern
sSortable date time pattern (based on ISO 8601) using local time
tShort time pattern
TLong time pattern

 Custom Date Format codes

Where standard date codes are too restrictive, create your own custom formats using the format patterns listed below.

Full list of the supported masks can be found in the following MSDN article: Custom DateTime masks

For example, a DateFormat of "ddd, MMMM yyyy - dd" might display:WinForms RadMaskedEditBox editors-maskededitbox-date-and-time-masks 001

Format PatternDescription
ddThe numeric day of the month.
dddThe abbreviated name of the day of the week.
MThe month name followed by the numeric day.
MMThe numeric month.
MMMThe abbreviated name of the month.
MMMMThe full name of the month.
yThe full month name and year numeric.
yyThe year without the century.
yyyThe year in four digits, including the century.
hThe hour in a 12-hour clock.
hhThe hour in a 12-hour clock.
HThe hour in a 24-hour clock.
HHThe hour in a 24-hour clock.
mThe minute.
mmThe minute.
sThe second.
ssThe second.
tThe first character in the AM/PM designator.
ttThe AM/PM designator.

Accessing the MaskDateTimeProvider

When the mask type is set to DateTime you can access the MaskDateTimeProvider by casting to that appropriate type.

C#
radMaskedEditBox1.MaskType = MaskType.DateTime;
MaskDateTimeProvider provider = this.radMaskedEditBox1.MaskedEditBoxElement.Provider as MaskDateTimeProvider;
provider.AutoSelectNextPart = true;

More information about this provider can be found in the last section of the following article: RadDateTimePicker Properties

See Also