Formatted Time

lightning-formatted-time

Displays a formatted time in user's locale format.

For Use In

Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App, Mobile Offline

A lightning-formatted-time component displays a read-only representation of time in the user's locale format. A valid ISO8601 formatted time string must be used.

An ISO8601 formatted time string matches one of the following patterns.

  • HH
  • HH:mm
  • HH:mm.SSS

HH is the number of hours that have passed since midnight, mm is the number of minutes that have passed since the start of the hour, ss is the number of seconds since the start of the minute, and SSS is the number of milliseconds since the start of the second. Time is always displayed in Universal Time (UTC).

Offsets aren't supported, and the component ignores them. For example, 14:30+05:00 is treated as 14:30.

The following example returns 10:12:30 PM.

Salesforce uses the format HH:mm.SSSZ for time fields. The time field is a timestamp without the date included. Time values in Salesforce are not localized or associated with a time zone.