Date and numeric fields can have format masks entered to define how the data returned for that field is displayed. Format masks are required for date fields. Format masks are case-sensitive. For instance, if you enter M, you indicate Month, and if you enter m you indicate minutes.
Symbol |
Meaning |
Presentation |
Example |
G |
Era Designator |
Text |
AD |
y |
Year |
Number |
1996 |
M |
Month in Year |
Text & Number |
July & 07 |
d |
Day in Month |
Number |
10 |
h |
Hour in AM/PM (1-12) |
Number |
12 |
H |
Hour in Day (0-23) |
Number |
0 |
m |
Minute in Hour |
Number |
30 |
s |
Second in Minute |
Number |
55 |
S |
Millisecond |
Number |
978 |
E |
Day in Week |
Text |
Tuesday |
D |
Day in Year |
Number |
189 |
F |
Day of Week in Month |
Number |
2 (2nd Wed in July) |
w |
Week in Year |
Number |
27 |
W |
Week in Month |
Number |
2 |
a |
AM/PM Marker |
Text |
PM |
k |
Hour in Day (1-24) |
Number |
24 |
K |
Hour in AM/PM (0-11) |
Number |
0 |
x |
Time Zone |
Text |
Pacific Standard Time |
' |
Escape for Text |
Delimiter |
|
" |
Single Quote |
Literal |
' |
The count of pattern letters determine the format.
For Text types, if there are four or more pattern letters, use the full form. If there are less than four pattern letters, use the short or abbreviated form.
For Number types, the minimum number of digits should be entered. If a number is entered that is less than this number of digits, they will be padded with zeros to this amount. For y (Year), if the count of 'y' is 2, the Year will be truncated to 2 digits.
For Text & Number types, if there are three or more pattern letters, use text. If less than three pattern letters are entered, us the number.
Examples:
Format Patten |
Result |
yyyy.MM.dd G 'at' hh:mm:ss z |
1996.07.10 AD at 15:08:56 PDT |
EEE, MMM d, ''yy |
Wed, July 10, '96 |
h:mm a |
12:08 PM |
hh 'o''clock' a, zzzz |
12 o'clock PM, Pacific Daylight Time |
K:mm a, z |
0:00 PM, PST |
yyyyy.MMMMM.dd GGG hh:mm aaa |
1996.July.10 AD 12:08 PM |
Number format masks can contain a positive and negative mask, separated by a semi-colon. Zeros and # represent digits that must be present. Commas add thousand separators, while decimals show where the decimal goes. In the following example, negative values will be displayed surrounded by parentheses.
For example: #,##0.00;(#,##0.00). #,##0.00 is the positive display. (#,##0.00) is the negative display.