Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions round counter to two decimal points while using ".toLocaleString("de-GE")"

  • round counter to two decimal points while using ".toLocaleString("de-GE")"

    Posted by Christopher Hesse on January 3, 2023 at 9:25 am

    I have a problem, which should have a simple solution, but I can’t seem to wrap my head around it.

    I’ve built a counter, using the following expression:

    beginVal =effect(“startVal,endVal”)(“point”)[0];

    endVal = (effect(“startWert,endWert”)(“point”)[1]);

    startT = effect(“startTime,endTime”)(“point”)[0];

    endT = effect(“startTime,endTime”)(“point”)[1];

    t = ease(time,startT,endT,beginVal,endVal).toLocaleString(“de-GE”);

    The counter is supposed to separate thousands with a dot, but decimals with a comma, which is why I used the “toLocaleString”-method. The problem is, that the counter is spitting out three decimals while counting, but I only want it to use two decimals.

    Does anybody have a solution?



    Christopher Hesse replied 1 year, 4 months ago 1 Member · 1 Reply
  • 1 Reply
  • Christopher Hesse

    January 3, 2023 at 1:13 pm

    At last, I did solve it myself and I realized that there were some errors in the original code I posted here, since I translated the “control for points” effect from german to english. I used point controls to circumvent the slider problem of going higher than 1 million and also to keep the effect controls to a minimum.
    Anyhow, here’s the final code:

    beginVal = effect(“Point Control”)(“Point”)[0];
    endVal = effect(“Point Control”)(“Point”)[1];
    startT = effect(“Point Control 2“)(“Point”)[0];
    endT = effect(“Point Control 2”)(“Point”)[1];
    decs = effect(“Slider Control”)(“slider”);

    t = ease(time,startT,endT,beginVal,endVal).toLocaleString(“de-DE” , {minimumFractionDigits: decs, maximumFractionDigits: decs});

    the “de-DE” stands for german formatting of numbers, but you can change that to whatever formatting you need. I’ve appended a link to where the most common ones are listed.


We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy