You need to sign in to do that
Don't have an account?
RarLopz
When I get a response from the webservice, how can i display the time I get the response on lightning component
i am trying to display the time from Apex controller to Lightning component.
is it possible to directly get Datetime.now () in the js controller and display it on the component? ({ ctr : function(cmp, event, helper) { var temp = []; var action = cmp.get("c.getGraph"); action.setParams({ "accountid": cmp.get("v.recordId") }); action.setCallback(this, function(response){ if(response.getState() === 'SUCCESS' && response.getReturnValue()){ temp = response.getReturnValue(); helper.createGraph(cmp, temp); } }); $A.enqueueAction(action); }, cancelAction: function(component, event, helper) { $A.get("e.force:closeQuickAction").fire(); } })
Greetings to you!
I have added a field in the temp variable as the dateTime field. you can display this dateTime any where on your component by storing temp variable in an aura attribute variable.
if yoy have datetime value in the response then you can use aura component formatted date time to display it.
https://developer.salesforce.com/docs/component-library/bundle/lightning:formattedDateTime/example
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
All Answers
Greetings to you!
I have added a field in the temp variable as the dateTime field. you can display this dateTime any where on your component by storing temp variable in an aura attribute variable.
if yoy have datetime value in the response then you can use aura component formatted date time to display it.
https://developer.salesforce.com/docs/component-library/bundle/lightning:formattedDateTime/example
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