lightning:formattedTime

Displays a formatted time in user's locale format. This component requires API version 42.0 and later.

A lightning:formattedTime 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 is the number of hours that have passed since midnight, and mm is the number of minutes that have passed since the start of the hour, and ss is the number of seconds since the start of the minute. To indicate that a time is measured in Universal Time (UTC), append a Z to a time.

The following example returns 10:12:30 PM.

<aura:component>
    <lightning:formattedTime value="22:12:30.999Z" />
</aura:component>

Salesforce uses the format HH:mm:ss.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.

Attributes

Attribute Name Attribute Type Description Required?
body Component[] The body of the component. In markup, this is everything in the body of the tag.
class String A CSS class for the outer element, in addition to the component's base classes.
title String Displays tooltip text when the mouse moves over the element.
value String The time value to format.