3.2.2.3.1. Datatype Format Strings

Locale-dependent parsing formats are provided in the main messages pack of the application or its components. They follow the logic of standard Java SE classes, such as DecimalFormat (see https://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html) or SimpleDateFormat (see https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html).

The formats should be provided in the strings with the following keys:

  • numberDecimalSeparator – decimal separator for numeric types.

    # comma as decimal separator
    numberDecimalSeparator=,
  • numberGroupingSeparator – thousands separator for numeric types.

    # space as thousands grouping separator
    numberGroupingSeparator = \u0020
  • integerFormat – format for Integer and Long types.

    # disable thousands grouping separator for integers
    integerFormat = #0
  • doubleFormat – format for Double type. Note that symbols used for decimal and grouping separators are defined in their own keys shown above.

    # rounding up to three digits after decimal separator
    doubleFormat=#,##0.###
  • decimalFormat – format for BigDecimal type. Note that symbols used for decimal and grouping separators are defined in their own keys shown above.

    # always display two digits after decimal separator, e.g. for currencies
    decimalFormat = #,##0.00
  • dateTimeFormat – format for java.util.Date type.

    # Russia date+time format
    dateTimeFormat = dd.MM.yyyy HH:mm
  • dateFormat – format for java.sql.Date type.

    # United States date format
    dateFormat = MM/dd/yyyy
  • timeFormat – format for java.sql.Time type.

    # hours:minutes time format
    timeFormat=HH:mm
  • offsetDateTimeFormat – format for java.time.OffsetDateTime type.

    # date+time format with an offset from GMT
    offsetDateTimeFormat = dd/MM/yyyy HH:mm Z
  • offsetTimeFormat – format for java.time.OffsetTime type.

    # hours:minutes time format with an offset from GMT
    offsetTimeFormat=HH:mm Z
  • trueString – string corresponding to Boolean.TRUE.

    # alternative displaying for boolean values
    trueString = yes
  • falseString – string corresponding to Boolean.FALSE.

    # alternative displaying for boolean values
    falseString = no

Studio allows you to set format strings for languages used in your application. Edit Project Properties, click the button in the Available locales field, then click Show data format strings.

Format strings for a locale can be obtained using the FormatStringsRegistry bean.