1

I need to change the format that the selected date displays in, for the ui:inputDateTime . enter image description here

I want it to display in the format "MM/dd/yyyy"

the tag looks like this :

<ui:inputDateTime aura:id="EndDateField" value="{!v.Task.pse__End_Date_Time__c }" displayDatePicker="true" />

2 Answers 2

2

Update looks like it is a bug in the date/time input

Seems that the DateTime does not utilize the format and uses the locale?

If you do not need the time then this does format properly

<ui:inputDate aura:id="EndDateField" value="{!v.Task.pse__End_Date_Time__c }" displayDatePicker="true" format="MM/dd/yyyy"/>

original discussion

Add the format="MM/dd/yyyy"

<ui:inputDateTime aura:id="EndDateField" value="{!v.Task.pse__End_Date_Time__c }" displayDatePicker="true" format="MM/dd/yyyy"/>

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_ui_inputDateTime.htm

format | String | The java.text.SimpleDateFormat style format string.

1
  • It is working Just try this: <ui:inputDate aura:id="expiry-date" class="field" value="{!v.today}" displayDatePicker="true" format="MM/DD/YYYY" /> The only thing missing in the above answer is a double quote... Sep 24, 2018 at 4:42
0

This is a known issue that Salesforce has listed as "No Fix" https://success.salesforce.com/issues_view?id=a1p3A000000AU8aQAG

nofix

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .