I'm displaying a date field on the Aura component. Following is the code,

<aura:iteration items= "!v.contactList}" var="type">
<lightning:tile label="{!type.Name}">
        End Date:
        <li class="slds-item">{!type.EndDate__c}</li>

I'm getting the output as, Output Date : 2020-04-02

I want the output to be in MM/DD/YYYY format.

How can I get format that on Lightning side.


Use the date formatter:

<li class="slds-item"><lightning:formattedDateTime value="{!type.EndDate__c}"/></li>

This component has a number of attributes to control how the date is formatted. Refer to the documentation for details.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.