Defining a Mask (Field_Mask)
If the default mask provided for the Field_Mask_Type does not fit the needs of your field, you may customize the mask by explicitly creating your own field mask. You do this by setting the Field_Mask property. The mask rules that can be applied to a field are determined by the field’s mask type as follows:
Mask Window or None
| Token | Meaning |
|---|---|
# |
Any numeric digit (0-9) |
@ |
Any alphabetic character (A-Z, a-z) |
! |
Any punctuation character |
* |
Any single printable character |
Date Mask Type
| Token | Meaning |
|---|---|
m |
Month number, displayed as 1, 2, 3, …, 12 |
mm |
Month number, displayed as 01, 02, 03, …, 12 |
mmm |
Month name abbreviated (translated to local language setting). For example, in English this would display Jan, Feb, Mar, …, Dec |
mmmm |
Month name (translated to local language setting). For example, in English this would display January, February, March, …, December |
d |
Day number, displayed as 1, 2, 3, …, 31 |
dd |
Day number, displayed as 01, 02, 03, …, 31 |
ddd |
Day of the week name abbreviated (translated to local language setting). For example, in English this would display Sun, Mon, …, Sat |
dddd |
Day of the week name (translated to local language setting). For example, in English this would display Sunday, Monday, …, Saturday |
yy |
Year number, displayed as 00, 01, 02, …, 99 |
yyyy |
Four-digit year number displayed as 2000, 2001, 2002, …, 2099 |
/ |
This represents the local date separator. |
Special Note:
- Tokens for the month and day names are case-sensitive. That is,
Mmmwould produceApr, whileMMMwould produceAPRfor the fourth month. - In most cases, the mask string is not used, but instead, the Windows Regional Settings are used to determine how to display dates.
DateTime Mask Type
| Token | Meaning |
|---|---|
m |
Month number, displayed as 1, 2, 3, …, 12 |
mm |
Month number, displayed as 01, 02, 03, …, 12 |
mmm |
Month name abbreviated (translated to local language setting). For example, in English this would display Jan, Feb, Mar, …, Dec |
mmmm |
Month name (translated to local language setting). For example, in English this would display January, February, March, …, December |
d |
Day number, displayed as 1, 2, 3, …, 31 |
dd |
Day number, displayed as 01, 02, 03, …, 31 |
ddd |
Day of the week name abbreviated (translated to local language setting). For example, in English this would display Sun, Mon, …, Sat |
dddd |
Day of the week name (translated to local language setting). For example, in English this would display Sunday, Monday, …, Saturday |
yy |
Year number, displayed as 00, 01, 02, …, 99 |
yyyy |
Four-digit year number displayed as 2000, 2001, 2002, …, 2099 |
/ |
This represents the local date separator. |
hh |
Hour number, displayed as 01, 02, 03,...,12 |
mm |
Minute number, displayed as 01, 02, 03,...,59 |
ss |
Second number, displayed as 01, 02, 03,...,59 |
f |
Fractions of second, displayed with a minimum of 1 digit, displayed as 1, 2, 3,...,999 |
fff |
Fractions of second, displayed with 3 digits, displayed as 001, 002, 003,...,999 |
: |
This represents the local time separator. |
Special Note:
- Tokens for the month and day names are case-sensitive. That is,
Mmmwould produceApr, whileMMMwould produceAPRfor the fourth month. - The default DateTime mask is based on Windows Regional Settings, and it does not include fractions of seconds, which is usually what you want.
- If you specify a mask like
mm/dd/yyyy hh:mm:sswithout fractions, fractions of seconds won't be expected from the input of Set Value and won't be available for editing or in the output of Get Value. Data not displayed according to the mask, e.g., fractions of seconds (or the entire time portion) is omitted, is lost.
Numeric and Currency Mask Type
| Token | Meaning |
|---|---|
, |
This token formats the number by inserting a thousands’ separator every three places to the left of the decimal place. The thousands’ separator is translated into the local thousands’ separator symbol. |
. |
This token represents the position of the decimal point. It is translated into the local decimal point symbol. |
; |
The semi-colon token is used to split the mask string into two parts. The left half is used to format numbers greater or equal to 0 and the right half for numbers less than 0. |
# |
Specifies no digit or one digit. |
* |
Specifies any number of digits. |
0 |
Specifies one digit, or a 0 (zero). |
$ |
Currency symbol. |
Note:
- You can use Default_Currency_Symbol to get the currency symbol set in the Windows Regional settings.
- Non-token characters in mask strings are treated as literals (they are inserted where seen into masked field values). This includes the space character. Token characters can be deactivated and made to appear as literals in masked values by preceding them with a backslash (
\).