Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Product Class Structure
    Supported Formats
   [Expand]Getting Started
   [Expand]RichEditControl Document
   [Collapse]Fields
    [Expand]Field Codes
    [Collapse]Format Switches
      General Format Switch
      Numeric Format Switch
      Date and Time Format Switch
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Printing
    AutoCorrect
    Mail Merge
    Restrictions and Protection
    Syntax Highlighting
    Traversing the Document
   [Expand]Visual Elements
    Services
    Events
    Commands
    HTML Tag Support
   [Expand]Examples
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Date and Time Format Switch

Expanded Syntax

\@ [ " ] switch-argument [ " ]

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

Expanded 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.

Specifier Description
d Displays the day as a number without a leading zero for single-digit days.
dd Displays the day as a number with a leading zero for single-digit days.
ddd Displays the day of the week in its abbreviated form according to the current culture.
dddd Displays the full name of the day of the week according to the current culture.
M Displays the month as a number without a leading zero for single-digit months.
MM Displays the month as a number with a leading zero for single-digit months.
MMM Displays the month in its abbreviated form according to the current culture.
MMMM Displays the full name of the month according to the current culture.
yy Displays the year number as two digits with a leading zero for years 0 - 9.
yyyy Displays the year number as four digits
h or H Displays the hour as a number without a leading zero for single-digit hours.
hh or HH Displays the hour as a number with a leading zero for single-digit hours.
m Displays the minutes as a number without a leading zero for single-digit minutes.
mm Displays the minutes as a number with a leading zero for single-digit minutes.
am/pm or AM/PM Displays time using am/pm or AM/PM notation.
ss Displays the seconds as a number with a leading zero for single-digit seconds.

Expanded 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

Is this topic helpful?​​​​​​​