This is because
ui:outputDate shows time in UTC, but
lightning:formattedDateTime shows time based on
runtime environment's time zone which will be different based on location. If you want this to be specific time zone then you can set that using
timeZone attribute of
The time zone to display. Use this attribute only if you want to
override the default, which is the runtime environment's time zone.
Specify a time zone listed in the IANA time zone database
(https://www.iana.org/time-zones). For example, set the value to
'Pacific/Honolulu' to display Hawaii time. The short code UTC is also
This is how you can specify time zone.
<lightning:formattedDateTime value="1547250828000" timeZone="UTC" />
Which will show you an exact time as in
If you want American time zone then below code should work for you.
<lightning:formattedDateTime value="1547250828000" year="numeric" month="numeric" day="numeric" hour="2-digit" minute="2-digit" timeZoneName="short" timeZone="America/New_York" />
Please note that
ui:outputDate is Deprecated as of API version 47.0. Use lightning:formattedDateTime instead.
Please refer for more details.