This topic is under construction for the 24.11 (November 2024) release. For the previous documentation of this feature, click here and here.
LabKey Server provides flexible display formatting for dates, times, datetimes, and numbers, so you can control how these values are shown to users. Set up formats that apply to the entire site, an entire project, a single folder, or even just to an individual field in one table.
Overview
You can customize how dates, times, datetimes, and numbers are displayed on a field-by-field basis, or set these formats on a folder-level, project-level or site-wide basis. The server decides which format to use for a particular field by looking first at the properties for that field. If no display format is set at the field-level, it checks the container tree, starting with the folder then up the folder hierarchy to the site level. In detail, decision process goes as follows:
- The server checks to see if there is a field-level format set on the field itself. If it finds a field-specific format, it uses that format. If no format is found, it looks to the folder-level format. (To set a field-specific format, see Set Formats on a Per-Field Basis.)
- If a folder-level format is found, it uses that format. If no folder-level format is found, it looks in the parent folder, then that parent's parent folder, etc. until the project level is reached and it looks there. (To set a folder-level default format, see Set Folder Display Formats)
- If a project-level format is found, it uses that format. If no project-level format is found, it looks to the site-level format. (To set a project-level default format, see Set Project Display Formats.)
- To set the site-level format, see Set Formats Globally (Site-Level). Note that if no site-level format is specified, the server will default to these formats:
- Date format: yyyy-MM-dd
- Time format: HH:mm
Date, time, and date-time formats are selected from a set of built in options. A standard
Java format string specifies how numbers are displayed.
Set Site-Wide Display Formats
An admin can set formats at the site level by managing look and feel settings.
- Select (Admin) > Site > Admin Console.
- Under Configuration, click Look and Feel Settings.
- Scroll down to Customize date, time, and number display formats.
Set Project Display Formats
An admin can
standardize display formats at the project level so they display consistently in the intended scope, which does not need to be consistent with site-wide settings.
- Navigate to the target project.
- Select (Admin) > Folder > Project Settings.
- On the Properties tab, scroll down to Customize date, time, and number display formats.
- Check the "Inherited" checkbox to use the site-wide default, or uncheck to set project-specific formats:
- Select desired formats for date, date-time, and time-only fields.
- Enter desired format for number fields.
- Click Save.
Set Folder Display Formats
An admin can
standardize display formats at the folder level so they display consistently in the intended scope, which does not need to be consistent with either project or site settings.
- Navigate to the target folder.
- Select (Admin) > Folder > Management.
- Click the Formats tab.
- Check the "Inherited" checkbox to use the project-wide format, or uncheck to set folder-specific formats:
- Select desired formats for date, date-time, and time-only fields.
- Enter desired format for number fields.
Set Formats on a Per-Field Basis
To do this, you edit the properties of the field.
- Open the data fields for editing; the method depends on the type. See: Field Editor.
- Expand the field you want to edit.
- Date, time, and datetime fields include a Use Default checkbox, and if unchecked you can use the Format for Date Times selectors to choose among supported date and time formats just for this field.
- Number fields include a Format for Numbers box. Enter the desired format string.
- Click Save.
Date, Time, and DateTime Display Formats
Date, Time, and DateTime display formats are selected from a set of standard options, giving you flexibility for how users will see these values. DateTime fields combine one of each format, with the option of choosing "<none>" as the Time portion.
Date formats available:
Format Selected | Display Result |
---|
yyyy-MM-dd | 2024-08-14 |
yyyy-MMM-dd | 2024-Aug-14 |
dd-MMM-yyyy | 14-Aug-2024 |
ddMMMyyyy | 14Aug2024 |
ddMMMyy | 14Aug24 |
MM/dd/yyyy | 08/14/2024 |
MM-dd-yyyy | 08-14-2024 |
dd-MM-yyyy | 14-08-2024 |
yyyy-MM | 2024-08 |
MMMM dd yyyy | August 14 2024 |
Time formats available:
Format Selected | Display Results |
---|
HH:mm:ss | 13:45:15 |
HH:mm | 13:45 |
HH:mm:ss.SSS | 13:45:15.000 |
hh:mm a | 01:45 PM |
Number Format Strings
Format strings for Number (Double) fields must be compatible with the format that the java class
DecimalFormat accepts. A valid DecimalFormat is a pattern specifying a prefix, numeric part, and suffix. For more information see the
Java documentation. The following table has an abbreviated guide to pattern symbols:
Symbol | Location | Localized? | Meaning |
---|
0 | 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 |
E | Number | Yes | Exponent for scientific notation, for example: 0.#E0 |
Examples
The following examples apply to Number (Double) fields.
Format String | Display Result |
---|
<no string> | 85.0 |
0 | 85 |
000 | 085 |
.00 | 85.00 |
000.000 | 085.000 |
000,000 | 085,000 |
-000,000 | -085,000 |
0.#E0 | 8.5E1 |
Related Topics