Date Display Format
Summary
- AdapTable provides a number of Display Formats to be used with Date Columns
Users can use the Date Formatter to set their own date pattern (or select one of the presets).
The object has a single Pattern property:
| Property | Type | Description |
|---|---|---|
| Pattern | string | Pattern to use for Date Format |
Find Out More
Find the full list of available DateTime patterns at the unicode website
Date Presets
Similar to numeric columns, AdapTable provides some presets for commonly used Date Formats:
| Preset | Example (using 5 August 2023 at 10:30pm) |
|---|---|
| MM/dd/yyyy | 08/05/2023 |
| dd-MM-yyyyy | 05-08-2023 |
| MMMM do yyyy, h:mm:ss a | August 5th 2023, 10:30:00 PM |
| EEEE | Saturday |
| MMM do yyyy | Aug 5th 2023 |
| yyyyMMdd | 20230805 |
| HH:mm:ss | 22:30:00 |
- This example shows 3 different Date Formats
Createdhas a format of 'yyyy/MM/dd'Updatedhas a format of 'MMM do yyyy'Pushedhas a format of 'EEEE'
Expand to see the Date Display Formats
FAQ
Can we show only the time portion of a date?
Yes. Set Pattern to a time-only pattern such as HH:mm:ss (also available as a wizard preset).
How do we set a custom date layout?
Set DisplayFormat to { Formatter: 'DateFormatter', Options: { Pattern: '…' } } }. Pattern letters follow the Unicode date field symbols table linked above.
Are date presets the same as numeric presets?
No. Date wizard presets are shortcuts that fill in Pattern; there is no DisplayFormat: 'ShortDate' style name in state. Numeric columns can use preset names directly in DisplayFormat.