The following table shows the symbols most commonly used in Date/time format masks.
Symbol |
Description |
---|---|
9 |
Represents one numeric character. The number of 9's determines the number of digits the text item can display. |
MM |
Month (01-12). |
MON |
Name of month, 3-letter abbreviation. |
MONTH |
Name of month, padded with blank spaces to length of 9 characters. |
DD |
Day of month (1-31). |
DY |
Name of day, 3-letter abbreviation. |
DAY |
Name of day, padded with blanks to length of 9 characters. |
YYYY,YYY, YY, |
4, 3, 2, or 1-digit year. |
HH or HH12 |
Hour of day (1-12). |
HH24 |
Hour of day (0-23). |
MI |
Minute (0-59). |
SS |
Second (0-59). |
AM or A.M. or PM or P.M. |
Meridian indicator. |
TH |
Ordinal number (e.g., "DDTH" for "15TH"). |
SP |
Spelled out number (e.g.,, "DDSP" for "FIFTEEN"). |
SPTH or THSP |
Spelled out ordinal number (e.g.,, "DDSPTH" for "FIFTEENTH" |
FM |
Prefix used with symbols such as MONTH and DAY to suppress padding added by these symbols. Also suppresses leading zeroes for number symbols such as HH and MM. FM is a toggle. If FM appears twice in a Date format model,, blank padding and leading zeroes are suppressed for elements after the first FM,, and are re-enabled after the second. |
To embed a character string in a Date/time format mask, enclose it in double quotes. (Note: you cannot embed double quotes themselves as characters in a mask. In other words, attempting to have something like DD"MM appear by coding the mask as DD"""MM will produce unexpected results.)
Spaces and punctuation characters (/ . , : ' - ) can be embedded in a Date/time format mask without enclosing them in double quotes.
Examples:
Format Mask |
Displayed Value |
---|---|
"Today's Date is " fmDAY, fmMONTH DDTH |
Today's Date is Tuesday, March 16TH |
Example
The following table shows examples of format masks for DATE and DATETIME values:
Format Mask |
Data Type |
Result |
---|---|---|
MM/DD/YYYY |
DATE |
03/15/1995 |
MONTH 15 YYYY |
DATE |
MARCH 15 1995 |
fmMONTH 15 1995 |
DATE |
MARCH 15 1995 |
Day, "the" DDTH "of" fmMonth |
DATE |
Wednesday, the 15TH of March |
J |
DATE |
2449792 |
HH:MI PM |
TIME |
10:30 PM |
HH24:MI |
TIME |
20:30 |
MM-DD-YY HH:MI AM |
DATETIME |
03-15-95 06:30 AM |
fmMM-DD-YY fmHH:MI AM |
DATETIME |
3-15-95 06:30 AM |
fmMonth YY |
DATETIME |
March 95 |
About formatting text item values with format masks
Assigning a format mask to a text item