Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Two digit expression for days of the month

  • Two digit expression for days of the month

    Posted by Jos Newbolt on August 9, 2023 at 3:15 pm

    Hi there,

    I’m sure this question has been asked a thousand times but after much digging through here I seem to be coming up short.

    I’m using this expression to get the days of the month to work on a slider

    slider = effect(“Slider Control”)(“Slider”);

    seconds = Math.round(slider%30);

    but i need it to always show two digits when the value is less than ten.

    so “01” instead of just “1”.

    Can someone please show me what i’m missing.

    Many thanks,

    Jos

    Filip Vandueren replied 2 years, 9 months ago 2 Members · 1 Reply
  • 1 Reply
  • Filip Vandueren

    August 9, 2023 at 6:21 pm

    Hey Jos,

    I find this method the easiest:

    seconds.toString().padStart(2,”0″);

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