The following reference accompanies the topic
Date & Number Display Formats.
Date and DateTime Format Strings
Format strings used to describe dates and date-times on the LabKey platform must be compatible with the format accepted by the Java class
SimpleDateFormat. For more information see the
java documentation. The following table has a partial guide to pattern symbols.
| Letter | Date/Time Component | Examples |
|---|
| G | Era designator | AD |
| y | Year | 1996; 96 |
| M | Month in year | July; Jul; 07 |
| w | Week in year | 27 |
| W | Week in month | 2 |
| D | Day in year | 189 |
| d | Day in month | 10 |
| F | Day of week in month | 2 |
| E | Day in week | Tuesday; Tue |
| a | Am/pm marker | PM |
| H | Hour in day (0-23) | 0 |
| k | Hour in day (1-24) | 24 |
| K | Hour in am/pm (0-11) | 0 |
| h ....... | Hour in am/pm (1-12) ....... | 12 ....... |
| m | Minute in hour | 30 |
| s | Second in minute | 33 |
| S | Millisecond | 978 |
| z | Time Zone | Pacific Standard Time; PST; GMT-08:00 |
| Z | Time Zone | -0800 |
| X | Time Zone | -08; -0800; -08:00 |
To control whether an internationally ambiguous date string such as 04/06/2014 should be interpreted as Day-Month-Year or Month-Day-Year, an admin can
set the date parsing format at the site level.
Note that the LabKey date parser does not recognize time-only date strings. This means that you need to enter a full date string even when you wish to display time only. For example, you might enter a value of "2/2/09 4:00 PM" in order to display "04 PM" when using the format string "hh aa".
Format Shortcuts
At the field level, instead of providing a specific format string, you can use a shortcut value for commonly used formats. For details, see
Date & Number Display Formats
Number Format Strings
Format strings for numbers 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 |
Examples
| Format String | Display Result |
|---|
| yyyy-MM-dd HH:mm | 2008-05-17 01:45 |
| yyyy-MM-dd HH:mmaa | 2008-05-17 01:45PM |
| MMMM dd yyyy | May 17 2008 |
| hh:mmaa zzzz | 01:45PM Pacific Daylight Time |
| <no string> | 85 |
| .00 | 85.00 |
| 000.000 | 085.000 |
| 000,000 | 085,000 |
| -000,000 | -085,000 |
Java Reference Documents
Dates:
http://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.htmlNumbers:
http://docs.oracle.com/javase/8/docs/api/java/text/DecimalFormat.html
Related Topics
Date & Number Display Formats