I would like to be able to do something like this:

$A.localizationService.WallTimeToUTC(d, timezone, function(utc) {
    displayDate = $A.localizationService.formatDateTime(utc, format, langLocale);

from a VisualForce page. I would like to be able to access the aura lightning $A global instance namespace from the VisualForce page, use components like <ui:outputCurrency>, or at least the localization service. If possible, what is the easiest workaround/way to accomplish this?

  • By using lightning out and converting you VF page to a lightning component. It's the only way $A is accessible AFAIK. You could always use JS localization methods I believe
    – Eric
    May 4, 2017 at 3:32
  • I would if I could, but I can't. Might have to use JS library. Any best suggestions for SF? I have looked at a few. May 4, 2017 at 3:42

1 Answer 1


You should be able to make an empty lightning app and component and call your localizationservice function in the callback of that component creation.

Something like this:

<apex:page >

    <!--rest of your page stuff -->

    <apex:includeLightning />

    <div style="display: none !important; id="lightning" />
    var displayDate;

    $Lightning.use("c:EmptyApp", function () {
      $Lightning.createComponent("c:EmptyComponent", {},
         lightning, function (cmp) {
             $A.localizationService.WallTimeToUTC(d, timezone, function(utc) {
                 displayDate = $A.localizationService.formatDateTime(utc, format, langLocale);

You could even try saving a reference to $A so you can call it again without instantiating a dummy component - ie in the callback, do something like:

window.$A = $A;

I don't know if this will work, but it might be worth a try.

  • Works. Probably can't do any better workaround... May 4, 2017 at 17:30
  • It's a bit naughty, but I'm glad it works. May 4, 2017 at 17:31

You must log in to answer this question.

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