[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Collapse]Editors and Simple Controls
    Included Controls and Components
   [Collapse]Common Editor Features and Concepts
    [Collapse]Input Mask
      Mask Type: Numeric
      Mask Type: Date-time
      Mask Type: TimeSpan
      Mask Type: Extended Regular Expressions
      Mask Type: Simple
      Mask Type: Simplified Regular Expressions
    [Expand]Format and Parse Editor Values
     Custom Editors
   [Expand]Lookup Editors
    Popup Container Editor
   [Expand]Token Edit Control
   [Expand]Breadcrumb Edit Control
   [Expand]Range Control
   [Expand]Image Slider
    Camera Control
    Templated ListBox Controls
   [Expand]Examples
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Mask Type: TimeSpan

Expanded Overview

The TimeSpan mask type allows users to enter time intervals. This type supports the standard time span .Net format.

Note

Run the XtraEditors demo to try out input masks.

Types

Input masks support the following time span types:

The RepositoryItemTextEdit.Mask property provides access to a MaskProperties class instance that specifies an input mask. Set the MaskProperties.MaskType property to MaskType.TimeSpan or MaskType.TimeSpanAdvancingCaret to enable the time span mask type. Use the MaskProperties.EditMask property to specify the mask expression.

Expanded Standard Masks

The table below contains input masks that correspond to the standard patterns. These patterns do not depend on culture settings.

Mask

Description

Remarks

Sample (the English (US) culture)

c

Constant Format

Matches the [-][d'.']hh':'mm':'ss['.'fffffff] pattern.

g

General Short Format

Matches the [-][d':']h':'mm':'ss[.FFFFFFF] pattern.

G

General Long Format

Matches the [-]d':'hh':'mm':'ss.fffffff pattern.

Expanded Custom Masks

Mask specifiers and modifiers in the table below allow you to create custom time span input masks. For example, the mm MM, ss SS mask expression specifies the following input mask:

Specifier/Placeholder

Description

Remarks

d

Number of whole days.

Displays a single digit in the first ten-day interval (1-9).

dd-dddddddd

Number of whole days.

Displays leading zeros.

D

Short caption for days.

'd' in the English (US) locale.

DD

Long caption for days.

'day' or 'days' in the English (US) locale.

h

Number of whole hours.

Displays a single digit in the first ten-day interval (1-9).

hh

Number of whole hours.

Displays two digits in the first-ten interval (01-09).

H

Short caption for hours.

'h' in the English (US) locale.

HH

Long caption for hours.

'hour' or 'hours' in the English (US) locale

m

Number of whole minutes.

Displays a single digit in the first ten-day interval (1-9).

mm

Number of whole minutes.

Displays two digits in the first-ten interval (01-09).

M

Short caption for minutes.

'm' in the English (US) locale.

MM

Long caption for minutes.

'minute' or 'minutes' in the English (US) locale.

s

Number of whole seconds.

Displays a single digit in the first-ten interval (1-9).

ss

Number of whole seconds.

Displays two digits in the first-ten interval (01-09).

S

Short caption for seconds.

's' in the English (US) locale

SS

Long caption for seconds.

'second' or 'seconds' in the English (US) locale.

n

Number of whole milliseconds.

Displays a single digit in the first-ten interval (1-9).

nn

Number of whole milliseconds.

Displays two digits in the first-ten interval (01-09).

nnn

Number of whole milliseconds.

Displays leading zeros.

N

Short caption for milliseconds.

'ms' in the English (US) locale.

NN

Long caption for milliseconds.

'milliseconds' in the English (US) locale.

f-fffffff

Number of second fractions.

F-FFFFFFF

Number of second fractions.

Any fractional trailing zeros are not included.

Z

Short caption for fractional part of seconds.

'f' in the English (US) locale.

ZZ

Long caption for fractional part of seconds.

'fractional' in the English (US) locale.

[,]

Elements in square brackets are optional.

:

Time separator.

Does not depend on the culture.

.

Decimal separator.

Does not depend on the culture.

"abc", 'abc'

Quoted string. Inserts the string enclosed in single or double quotes into the edit box.

The string cannot be edited in the text editor.

%<specifier>

The '%' modifier that precedes a mask specifier distinguishes the specifier from the same standard mask pattern (see above).

If a mask specifier is used without other specifiers, it can be interpreted as a standard pattern. For example, the 'd' specifier is interpreted as the standard short date pattern, but not a month day. Precede the specifier with the '%' modifier to interpret it as a placeholder.

\<character>

The backslash modifier is the escape character.

Precede a specifier with the backslash modifier to display the specifier as a character in the edit box.

Any other characters.

Any other characters are displayed in the edit box literally.

Examples

Example 1

d'.'hh':'mm':'ss - allows users to input days, hours, minutes, and seconds. The '.' and ':' characters are separators.

Example 2

d DD 'left' - allows users to input days. Displays custom text and the 'days' caption according to the culture.

Expanded End-User Capabilities

  • The Up and Down Arrow keys increase and decrease the time span value portion under the caret.
  • The mouse wheel increases and decreases the time span value portion under the caret.
  • The Left and Right Arrow keys moves the caret in the corresponding direction.
  • The Space key moves the caret to the next time span value portion.
  • The time separator key moves the caret to the next time portion.

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