Back to Devexpress

Date and Time Format Switch

wpf-17174-controls-and-libraries-rich-text-editor-fields-format-switches-date-and-time-format-switch.md

latest2.2 KB
Original Source

Date and Time Format Switch

  • Apr 01, 2021
  • 2 minutes to read

Syntax

@ [“] switch-argument [“]

A date-and-time format switch specifies the format of a date or time result.

Specifiers

Use “M” for the month, “d” for the Day. For the year, use “yy” or “yyyy”. For the Hours, use “h” or “hh” for the hour, “m” or “mm” for the minute, and “am/pm” to include the AM/PM designation. To include other text inside the result, enclose it in single quote marks.

You can combine the following specifiers to construct a format string.

SpecifierDescription
dDisplays the day as a number without a leading zero for single-digit days.
ddDisplays the day as a number with a leading zero for single-digit days.
dddDisplays the day of the week in its abbreviated form according to the current culture.
ddddDisplays the full name of the day of the week according to the current culture.
MDisplays the month as a number without a leading zero for single-digit months.
MMDisplays the month as a number with a leading zero for single-digit months.
MMMDisplays the month in its abbreviated form according to the current culture.
MMMMDisplays the full name of the month according to the current culture.
yyDisplays the year number as two digits with a leading zero for years 0 - 9.
yyyyDisplays the year number as four digits
h or HDisplays the hour as a number without a leading zero for single-digit hours.
hh or HHDisplays the hour as a number with a leading zero for single-digit hours.
mDisplays the minutes as a number without a leading zero for single-digit minutes.
mmDisplays the minutes as a number with a leading zero for single-digit minutes.
am/pm or AM/PMDisplays time using am/pm or AM/PM notation.
ssDisplays the seconds as a number with a leading zero for single-digit seconds.

Examples

  • Field code {DATE @ “‘Today is ‘MMM. d, yyyy”} results in Today is Dec. 29, 2011
  • Field code {DATE @ “‘Current time is ‘HH:mm:ss”} results in Current time is 17:13:15