Format Strings
Format Strings can be used to tell dbFront how to format and display numeric and date field types within Grids and Reports. Format Strings won't be applied when the field is displayed in Forms because a format string may hide information or make it difficult to edit.
dbFront uses the .Net formatting engine. Below are several charts detailing the formatting options. Additional References are below:
- Downloadable PDF Cheatsheet: .NET Format Strings - cheat sheets
- Detailed Microsoft Reference: Formatting Types in .NET
Numeric Formatting
Standard Numeric Format Strings |
||||
---|---|---|---|---|
Format Specifier |
Description |
Examples |
||
|
Currency |
C |
1 |
$1 $1.23 -$12,345 |
|
Decimal (Whole number) |
D4 |
1 |
0001 |
|
Scientific |
E3 |
Pi |
3.142E+000 |
|
Fixed-point |
F3 |
Pi |
3.142 |
|
General |
G |
1.23 |
1.23 |
|
Number | N N1 N4 |
1234.567 |
1,234.57 1,234.6 1234.5670 |
|
Percent | P P |
1 -0.39678 |
100.00 % 39.7 % |
|
Hexadecimal |
x |
255 |
ff FF 00FF |
Microsoft Definitive Reference: Standard Numeric Format Strings
Custom Numeric Format Strings |
||||
---|---|---|---|---|
Format Specifier |
Type |
Examples |
||
0 |
Zero placeholder | 00.0000 | 1234.56 | 1234.5600 |
# |
Digit placeholder | (#).## | 1234.56 | (1234).56 |
. |
Decimal point | 0.0 | 1234.56 | 1234.6 |
, |
Thousand separator | 0,0 | 1234.56 | 1,235 |
,. |
Number scaling. Comma adjacent to Period scales by 1000. | 0,. | 1234.56 | 1 |
% |
Percent. Multiplies by 100, adds % sign. | 0% | 1234.56 | 123456% |
e |
Exponent placeholder | 00e+0 | 1234.56 | 12e+2 |
; |
Section separator to allow formatting: Positive, Negative, and Zero values separately | ##;(##);Zero | 1234 -1234 0 |
1234 (1234) Zero |
Microsoft Definitive Reference: Custom Numeric Format Strings
Date Formatting
Note: Date formatting is especially dependent on your system’s cultural settings.
Standard Date & Time Format Strings |
||||
---|---|---|---|---|
Format Specifier |
Description |
Examples |
||
d |
Short date | 10/12/2100 | ||
D |
Long date | December 10, 2100 | ||
t |
Short time | 10:11 PM | ||
T |
Long time | 10:11:29 PM | ||
f |
Full date & time | December 10, 2100, 10:11 PM | ||
F |
Full date & time (long) | December 10, 210,0 10:11:29 PM | ||
g |
Default date & time | 10/12/2100 10:11 PM | ||
G |
Default date & time (long) | 10/12/2100 10:11:29 PM | ||
M |
Month day pattern | December 10 | ||
r |
RFC1123 date string | Tue, 10 Dec 2100 22:11:29 GMT | ||
s |
Sortable date string | 2100-12-10T22:11:29 | ||
u |
Universal sortable, local time | 2100-12-10 22:13:50Z | ||
U |
Universal sortable, GMT | December 11, 2100 3:13:50 AM | ||
Y |
Year month pattern | December, 2100 |
Microsoft Definitive Reference: Standard Date & Time Format Strings
Custom Date & Time Format Strings |
||||
---|---|---|---|---|
Format Specifier |
Type |
Examples |
||
dd |
Day | dd | 10 | |
ddd |
Day name | ddd | Tue | |
dddd |
Full day name | dddd | Tuesday | |
f, ff, … |
Second fractions | fff | 932 | |
gg, … |
Era | gg | A.D. | |
hh |
2 digit hour | hh | 10 | |
HH |
2 digit hour, 24hr format | HH | 22 | |
mm |
Minute 00-59 | mm | 38 | |
MM |
Month 01-12 | MM | 12 | |
MMM |
Month abbreviation | MMM | Dec | |
MMMM |
Full month name | MMMM | December | |
ss |
Seconds 00-59 | ss | 46 | |
tt |
AM or PM | tt | PM | |
yy |
Year, 2 digits | yy | 02 | |
yyyy |
Year | yyyy | 2100 | |
zz |
Timezone offset, 2 digits | zz | -05 | |
zzz |
Full timezone offset | zzz | -05:00 | |
: |
Separator | hh:mm:ss | 10:43:20 | |
/ |
Separator | dd/MM/yyyy | 10/12/2100 |
Microsoft Definitive Reference: Custom Date & Time Format Strings