- Code Repository
- Knowledge Base
- Servoy Components
- Servoy Consulting
How do the format options work on input fields?
Each field in Servoy has a "format" property that can be set. In the drop-down list are common formats used for display. However, you can also do a lot more that what is listed in the drop-down. The formats for dates are based on the SimpleDateFormat and DecimalFormat java class. Below is a list of possible format options.
Letter Date or Time Component Presentation Examples
Era designator Text
Month in year Month
Week in year Number
Week in month Number
Day in year Number
Day in month Number
Day of week in month Number
Day in week Text
Am/pm marker Text
Hour in day (0-23) Number
Hour in day (1-24) Number
Hour in am/pm (0-11) Number
Hour in am/pm (1-12) Number
Minute in hour Number
Second in minute Number
Time zone General time zone
Pacific Standard Time;
Time zone RFC 822 time zone
Symbol Location Localized? Meaning
Number Yes Digit
Number Yes Digit, zero shows as absent
Number Yes Decimal separator or monetary decimal separator
Number Yes Minus sign
Number Yes Grouping separator
Number Yes Separates mantissa and exponent in scientific notation. Need not be quoted in prefix or suffix.
Subpattern boundary Yes Separates positive and negative subpatterns
Prefix or suffix Yes Multiply by 100 and show as percentage
Prefix or suffix Yes Multiply by 1000 and show as per mille
Prefix or suffix No Currency sign, replaced by currency symbol. If doubled, replaced by international currency symbol. If present in a pattern, the monetary decimal separator is used instead of the decimal separator.
Prefix or suffix No Used to quote special characters in a prefix or suffix, for example,
"'#'#"formats 123 to
"#123". To create a single quote itself, use two in a row:
In addition you can also specify a different input and display format by using a pipe in the format of display|input. For example, $#,###.00|#.## will display with the dollar sign and force 2 decimal places, while allowing the user to enter in without the currency symbol, or decimals.
Finally, there are also server-wide defaults that can be set on the home page in the web server-admin, so you don't have to specify the format for every field. Instead, you can just enter your defaults on the server-admin page, and then override the defaults on a field by field basis.
- Knowledge Base: