Format Date
Date/time formatting with individual parts, timezones, and locale support.
<rhx-format-date>
Examples
Custom Format
<rhx-format-date rhx-date="@sampleDate" rhx-format="yyyy-MM-dd" />
<rhx-format-date rhx-date="@sampleDate" rhx-format="HH:mm:ss" />
<rhx-format-date rhx-date="@sampleDate"
rhx-format="MMMM d, yyyy h:mm tt" />
Individual Parts
<rhx-format-date rhx-date="@sampleDate"
rhx-month="long" rhx-day="numeric" rhx-year="numeric" />
<rhx-format-date rhx-date="@sampleDate"
rhx-month="short" rhx-day="numeric" />
<rhx-format-date rhx-date="@sampleDate"
rhx-month="numeric" rhx-day="numeric" rhx-year="numeric" />
<rhx-format-date rhx-date="@sampleDate"
rhx-weekday="long" rhx-month="long" rhx-day="numeric" />
<rhx-format-date rhx-date="@sampleDate" rhx-year="2-digit" />
Time
<rhx-format-date rhx-date="@sampleDate"
rhx-hour="2-digit" rhx-minute="2-digit" rhx-hour-format="24" />
<rhx-format-date rhx-date="@sampleDate"
rhx-hour="numeric" rhx-minute="2-digit"
rhx-second="2-digit" rhx-hour-format="12" />
<rhx-format-date rhx-date="@sampleDate"
rhx-month="long" rhx-day="numeric" rhx-year="numeric"
rhx-hour="numeric" rhx-minute="2-digit" rhx-hour-format="12" />
Timezone
<rhx-format-date rhx-date="@sampleDate"
rhx-timezone="America/New_York"
rhx-hour="numeric" rhx-minute="2-digit" rhx-hour-format="24" />
<rhx-format-date rhx-date="@sampleDate"
rhx-timezone="Asia/Tokyo"
rhx-hour="numeric" rhx-minute="2-digit" rhx-hour-format="24" />
Properties
| Property | Type | Default | Description |
|---|---|---|---|
rhx-date |
DateTimeOffset |
- |
The date/time value to format |
rhx-format |
string |
- |
.NET format string (e.g. yyyy-MM-dd) |
rhx-weekday |
string |
- |
Weekday display: long, short, narrow |
rhx-year |
string |
- |
Year display: numeric, 2-digit |
rhx-month |
string |
- |
Month display: numeric, 2-digit, long, short, narrow |
rhx-day |
string |
- |
Day display: numeric, 2-digit |
rhx-hour |
string |
- |
Hour display: numeric, 2-digit |
rhx-minute |
string |
- |
Minute display: numeric, 2-digit |
rhx-second |
string |
- |
Second display: numeric, 2-digit |
rhx-hour-format |
string |
- |
Clock format: 12, 24 |
rhx-timezone |
string |
- |
IANA timezone (e.g. America/New_York) |
Accessibility
- Renders as a
<time>element with adatetimeattribute for machine readability. - Screen readers announce the visible formatted text naturally.
- The
datetimeattribute provides an unambiguous ISO 8601 value for assistive technologies.