To understand how to format dates, let's copy the following code files into a new Lightning app (create a Lightning app bundle by using the Developer Console, and name it DateFormatterApp):
- DateformatterApp.app
<aura:application extends="force:slds"> <aura:attribute name="DateTimeInput" type="DateTime" /> <aura:attribute name="output" type="DateTime" /> <Lightning:input type="datetime-local" label="Input Date" name="date" value="{!v.DateTimeInput}"/> <Lightning:select aura:id="select" name="select" label="Select a pie" onchange="{! c.onChange }"> <option value="">choose one...</option> <option value="YYYY MM DD">YYYY MM DD format</option> <option value="MMMM DD YYYY, hh:mm:ss a">MMMM DD YYYY, hh:mm:ss a format</option> ...