I have a json coming from api and it has a datetime as 2019-01-01T00:00:00-05:00
I am displaying this in lightning component as <lightning:formattedDateTime value="{!medicareValues.effectivePeriod.datetimeBegin}" year="numeric" month="numeric" day="numeric"/>
. But I want to remove the time and display the date as 2019-01-01. Please let me know how I can achieve this.
I don't know of any Datetime to Date conversion function in lightning, but there is an easy solution server side; add a "dateBegin" to your effectivePeriod object that is the date component of your date time then use that in your formattedDateTime call instead. This might ultimately come from a formula field using the DATEVALUE formula function against the datetimeBegin value's field.
format()
function ofDate
apex class – sfdc_sk Mar 14 '19 at 6:20