[SalesForce] Change Date Format In Lightning

From lightning component, when I select the startdate and end date, I should able to select in MM-DD-YYY. But from backend Apex, it is coming as YYY-MM-DD 00:00:00. I want to convert this into that format. How can I do it?

Below is my code markup:

<ui:inputDate aura:id="startDate" required="true"   class="field"  displayDatePicker="true"   value="{!v.StartDate}" format="MM-DD-YYYY" blur="{!c.changeDateFormat}"/>

<ui:inputDate aura:id="endDate" required="true"   class="field"  displayDatePicker="true"   value="{!v.EndDate}" format="MM-DD-YYYY" blur="{!c.changeDateFormat}"/>

Best Answer

Please check the link below and compare the 2 input-types: Date (entering a date) and Datetime-local (entering a date and time). https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_lightning_input.htm