New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Formatting Dates

The table below shows a list of the standard format characters. For each standard pattern, it shows the pattern from the current Culture settings that the pattern represents. The format characters are case-sensitive; for example, 'f' and 'F' represent different patterns.

 

Format CharacterDescriptionr
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
yMonth year pattern

When you set the DateFormat or DisplayDateFormat property to one of these format characters, the RadDateInput control automatically expands it into aformat string built of the patterns listed below. Thus, changing the Culture property after setting the DateFormat or DisplayDateFormat property to one of these format characters will not change the overall pattern, but only the interpretation of symbols within the pattern.

The table below shows a list of patterns that can be combined to create custom patterns. The patterns are case-sensitive; for example, "MM" is recognized, but "mm" is not. If the custom pattern contains white-space characters or characters enclosed in single quotation marks, the output string will also contain those characters. Characters not defined as part of a format pattern or as format characters are reproduced literally.

 

Format PatternDescription
dThe day of the month. Single-digit days have no leading zero. (Only if used in the context of a longer pattern. A single "d" on its own represents the Short date pattern.)
ddThe day of the month. Single-digit days have a leading zero.
dddThe abbreviated name of the day of the week.
ddddThe full name of the day of the week.
MThe numeric month. Single-digit months have no leading zero. (Only if used in the context of a longer pattern. A single "M" on its own represents the Month day pattern.)
MMThe numeric month. Single-digit months have a leading zero.
MMMThe abbreviated name of the month.
MMMMThe full name of the month.
yThe year without the century. If the year without the century is less than 10, with no leading zero. (Only if used in the context of a longer pattern. A single "y" on its own represents the Month year pattern.)
yythe year without the century. If the year without the century is less than 10, with a leading zero.
yyyyThe year in four digits, including the century.
ggThe period or era (e.g. "A.D."). This pattern is ignored if the date to be formatted does not have an associated period or era.
hThe hour in a 12-hour clock. Single-digit hours have no leading zero.
hhThe hour in a 12-hour clock. Single-digit hours have a leading zero.
HThe hour in a 24-hour clock. Single-digit hours have no leading zero.
HHThe hour in a 24-hour clock. Single-digit hours have a leading zero.
mThe minute. Single-digit minutes have no leading zero. (Only if used in the context of a longer pattern. A single "m" on its own represents the Month day pattern)
mmThe minute. Single-digit minutes have a leading zero.
sThe second. Single-digit seconds have no leading zero. (Only if used in the context of a longer pattern. A single "s" on its own represents the sortable time pattern.)
ssThe second. Single-digit seconds have a leading zero.
tThe first character in the AM/PM designator. (Only if used in the context of a longer pattern. A single "t" on its own represents the short time pattern.)
ttThe AM/PM designator.

Since Q2 2015 SP1 release we have introduced a new property in RadDateInput, which is called EnableSmartParsing. When it is set to "false" (default value is "true") the automatic parsing/correction of the date/time entered is disabled.

See Also

In this article
See Also
Not finding the help you need?
Contact Support