Below follows information on how to specify the Time Format and the Numeric Format of the output field defined in the template. This feature utilizes the standard Java formatting 'patterns'. This Java documentation is not maintained by Unanet.
To specify the time format use a time pattern string. In this pattern, all ASCII letters are reserved as pattern letters, which are defined as the following:
Symbol Meaning Presentation Example
(Text): 4 or more pattern letters--use full form, < 4--use short or abbreviated form if one exists.
(Number): the minimum number of digits. Shorter numbers are zero-padded to this amount. Year is handled specially; that is, if the count of 'y' is 2, the Year will be truncated to 2 digits.
(Text & Number): 3 or over, use text, otherwise use number.
Any characters in the pattern that are not in the ranges of ['a'..'z'] and ['A'..'Z'] will be treated as quoted text. For instance, characters like ':', '.', ' ', '#' and '@' will appear in the resulting time text even they are not embraced within single quotes.
A pattern containing any invalid pattern letter will result in a thrown exception during formatting or parsing.
Examples Using the US Locale:
Format Pattern Result
--------------------------------------------------------------------------------
Patterns
A pattern contains a postive and negative subpattern, for example, "#,##0.00;(#,##0.00)". Each subpattern has a prefix, numeric part, and suffix. The negative subpattern is optional; if absent, then the positive subpattern prefixed with the localized minus sign ('-' in most locales) is used as the negative subpattern. That is, "0.00" alone is equivalent to "0.00;-0.00". If there is an explicit negative subpattern, it serves only to specify the negative prefix and suffix; the number of digits, minimal digits, and other characteristics are all the same as the positive pattern. That means that "#,##0.0#;(#)" produces precisely the same behavior as "#,##0.0#;(#,##0.0#)".
The prefixes, suffixes, and various symbols used for infinity, digits, thousands separators, decimal separators, etc. may be set to arbitrary values, and they will appear properly during formatting. However, care must be taken that the symbols and strings do not conflict, or parsing will be unreliable. For example, either the positive and negative prefixes or the suffixes must be distinct for the system to be able to distinguish positive from negative values. (If they are identical, then the system will behave as if no negative subpattern was specified.) Another example is that the decimal separator and thousands separator should be distinct characters, or parsing will be impossible.
The grouping separator is commonly used for thousands, but in some countries it separates ten-thousands. The grouping size is a constant number of digits between the grouping characters, such as 3 for 100,000,000 or 4 for 1,0000,0000. If you supply a pattern with multiple grouping characters, the interval between the last one and the end of the integer is the one that is used. So "#,##,###,####" == "######,####" == "##,####,####".
Illegal patterns, such as "#.#.#" or "#.###,###", will cause the system to display an error message with a message that describes the problem.
Special Pattern Characters
Many characters in a pattern are taken literally; they are matched during parsing and output unchanged during formatting. Special characters, on the other hand, stand for other characters, strings, or classes of characters. They must be quoted, unless noted otherwise, if they are to appear in the prefix or suffix as literals.
Symbol |
Location |
Localized? |
Meaning |
0 |
Number |
Y |
Digit |
# |
Number |
Y |
Digit, zero shows as absent |
. |
Number |
Y |
Decimal separator or monetary decimal separator |
- |
Number |
Y |
Minus sign |
, |
Number |
Y |
Grouping separator |
E |
Number |
Y |
Separates mantissa and exponent in scientific notation. Need not be quoted in prefix or suffix. |
; |
Sub-pattern boundary |
Y |
Separates positive and negative sub-patterns |
% |
Prefix or suffix |
Y |
Multiply by 100 and show as percentage |
\u2030 |
Prefix or suffix |
Y |
Multiply by 1000 and show as per mile |
¤ (\u00A4) |
Prefix or suffix |
N |
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 |
N |
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: "# o''clock". |
Time Quantity Format
Patterns
Currently, the only time format options are as follows:
Symbol |
Location |
Localized? |
Meaning |
h |
Number |
Y |
Hours in whole numbers (values < 10 will be one digit). |
hh |
Number |
Y |
Hours in whole number (values < 10 will have a leading zero |
mm |
Number |
Y |
Minutes in whole number (values < 10 will have a leading zero |