Skip to main content Home
About About the Design SystemRoadmap
Get started OverviewDesignersDevelopers
Foundations OverviewColorGridIconographyInteractionsSpacingTypography
Tokens Overview Global colorbox shadowTypographyborderopacityspacelengthIconBreakpointsMedia Queries
Elements All elements Accordion Alert Announcement Audio player Avatar Back to top Badge Blockquote Breadcrumb Button Card Chip Code block Call to action Dialog Disclosure Footer Health index Icon Jump links Navigation (primary) Navigation (secondary) Pagination PopoverPlanned Progress stepsPlanned Site status Skip link Spinner Statistic Subnavigation Surface Switch Table Tabs Tag Tile Timestamp Tooltip Video embed
Theming OverviewColor PalettesCustomizingDevelopers
Patterns All PatternsCardTabsFilterFormLinkLink with iconLogo wallSearch barSkip navigationSticky bannerSticky cardTileVideo thumbnail
Personalization All Personalization PatternsAnnouncement
Accessibility FundamentalsAccessibility toolsAssistive technologiesCI/CDContentContributorsDesignDevelopmentManual testingResourcesScreen readers
Design/code status Release notes Get support

Timestamp

OverviewStyleGuidelinesCodeAccessibilityDemos
UsageBasic formatsBehaviorResponsive designBest practicesUsageBasic formatsBehaviorResponsive designBest practices

Usage

Use a timestamp to display date and time values.

Default

By default, a timestamp will display the current date and time based on the current locale if the date attribute is not set.

Basic formats

The format of the displayed content can be customized by setting the date-format and/or time-format attributes. Setting only one of the attributes will display only the date or time, depending on which attribute is set. The possible options are full, long, medium, and short.

You can also set the display-suffix attribute to display a custom suffix at the end of the displayed content. This will not override a timezone that is already displayed from the applied time format.

Behavior

Custom format

The format of the displayed content can be further customized by setting the custom-format attributes. Read datetime format options for a list of options that can be set.

Adding a tooltip

To add a tooltip that displays the timestamp content as a UTC time, you can wrap rh-timestamp with rh-tooltip and set the UTC attribute on an additional rh-timestamp.

Timestamp with a tooltip on top showing the time with the UTC acronym at the end
<rh-tooltip>
  <rh-timestamp></rh-timestamp>
  <rh-timestamp slot="content" utc></rh-timestamp>
</rh-tooltip>
Timestamp with a tooltip on top showing the time and the words Coordinated Universal Time at the end
<rh-tooltip>
  <rh-timestamp></rh-timestamp>
  <rh-timestamp slot="content" utc display-suffix="Coordinated Universal Time"></rh-timestamp>
</rh-tooltip>

Relative time

To display relative time, set the relative attribute on rh-timestamp.

Relative time with tooltip

To display relative time, set the relative attribute on rh-timestamp.

Timestamp with a tooltip on top showing what the date and time would be 11 months previous
<rh-tooltip>
  <rh-timestamp relative date="Tue Aug 09 2022 14:57:00 GMT-0400 (Eastern Daylight Time)"></rh-timestamp>
  <rh-timestamp slot="content" date="Tue Aug 09 2022 14:57:00 GMT-0400 (Eastern Daylight Time)"></rh-timestamp>
</rh-tooltip>
Timestamp with a tooltip on top showing what the date and time would be in one year
<rh-tooltip>
  <rh-timestamp relative date="Aug 09 2024 14:57:00 GMT-0400 (Eastern Daylight Time)"></rh-timestamp>
  <rh-timestamp slot="content" date="Aug 09 2024 14:57:00 GMT-0400 (Eastern Daylight Time)"></rh-timestamp>
</rh-tooltip>

Set a locale other than default

The default locale is inferred by the browser. To set the locale to something else, set the locale attribute.

UTC timestamp

Set the UTC attribute.

Responsive design

Just like text, a timestamp will break to two lines as breakpoints get smaller.

Large breakpoints

Timestamp text on desktop and tablet breakpoints

Small breakpoints

Timestamp text on large and small mobile breakpoints with the smallest mobile example breaking to two lines

Best practices

Headings

Timestamp below a heading and using body copy styles

Use timestamp as part of the body copy.

Timestamp within heading and using heading style

Do not apply a timestamp to headings.

© 2021-2025 Red Hat, Inc. Deploys by Netlify