+ Start a Discussion
meghna nmeghna n 

date format in lightning:formatteddatetime

I am using a lightning:formatteddatetime inside lightning component

 <lightning:formattedDateTime value="{!v.claimDetails.effectiveDate}" year="numeric" month="numeric" day="2-digit"/>

It is displaying date as 05/15/2019

How to make the date display as   05/15/2019 instead of     5/15/2019

Thanks
Meghna
Vikash GoyalVikash Goyal
Hi Meghna,

You can try this :

<lightning:formattedDateTime value="{!v.claimDetails.effectiveDate}" year="numeric" month="2-digit" day="2-digit"/>

Thanks
Vikash
Deepali KulshresthaDeepali Kulshrestha
Hi Meghna,

Greetings to you!

Use the below code to solve your problem.
And you can modify it accordingly.
 
<aura:component >
<p><lightning:formattedDateTime value="1567421168000" year="numeric" month="2-digit" day="2-digit"/></p>    
</aura:component>
Use the below link.
https://developer.salesforce.com/docs/component-library/bundle/lightning:formattedDateTime/documentation

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com